Class: CurrentPredictor::Calculation

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

Class Method Summary collapse

Class Method Details

.consumption(appliances, cost) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/current_predictor.rb', line 23

def self.consumption(appliances,cost)
   appconsumed = appliances
   cost = cost
   sum = 0
   
        appconsumed.each do |key,value|
              if (key == "Washing_machiene")
                   washing = value * 600
               sum = washing+sum
              end
              if (key == "Light")
                  light = value * 100
                  sum = light+sum
              end
              if (key == "Cooker")
                   cooker = value * 660
               sum = cooker+sum
              end
              if (key == "Computer")
                  computer = value * 166
                  sum = computer+sum
                  puts "THE SUM OUTSTIDE IS #{sum}"
              end

    end
                  puts "THE SUM OUTSTIDE IS #{sum}"

              sum = sum/1000
              puts "THE SUM OUTSTIDE IS #{sum}"
              amount = sum * cost
             puts "Complete consumption per day for you is #{sum} KWH and its cost is #{amount}"
             month = sum * 30
             value = cost * month
             puts "Complete consumption per month for you is #{month} KWH and its cost is #{value} "
             return value
end

.monthlyconsumption(matter, room, cost) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/current_predictor.rb', line 12

def self.monthlyconsumption(matter,room,cost)
   consumption = matter
   cost = cost
   puts "Enter the number of rooms : "
   a = room
   b = (consumption*a)/12
   c = b*cost
  puts "Monthly consumption of a #{a} BHK rooms in terms of power consumption is #{b} KWH and the cost is #{c}"

  return a,b
end

.yearlyconsumption_onrooms(matter, room) ⇒ Object



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

def self.yearlyconsumption_onrooms(matter,room)
  consumption = matter
  puts "Enter the number of rooms : "
  a = room
  b = consumption*a
  puts "Yearly consumption of a #{a} BHK rooms in terms of power consumption is #{b} KWH"
  return a,b
end