Class: Filteranddiscount

Inherits:
Object
  • Object
show all
Defined in:
lib/x12117137.rb

Class Method Summary collapse

Class Method Details

.rundiscount(discount, price) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/x12117137.rb', line 13

def self.rundiscount(discount,price)
		if discount=="10% off"
		   price=price/10*9
	    else if discount=="20% off"
		        price=price/10*8
			 else if discount=="30% off"
		          price=price/10*7
				  else if discount=="40% off"
		                  price=price/10*6
					   else if discount=="half price"
		                       price=price/2
			                end	
			           end	
			      end	
			 end
		end
	return price
end

.runfilter(txt) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/x12117137.rb', line 2

def self.runfilter(txt)
	blockedWords = ["fucking","shit","stupid","foolish"]
	blockedWords.each { |x|
		if txt.include? x
			txt.gsub!(x, "****")
		end
	}
	
	return txt
end