Class: Carprice

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

Overview

Carprice.greet(7+3)

Class Method Summary collapse

Class Method Details

.cal(input) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/carcalculator.rb', line 6

def self.cal(input)

  taxrate = 0.13
  # storing the input
  price = input
  # * how much the company charges for finace for the car
  tax = price * taxrate
  # adding the tax into the car price
  totalprice = price + tax

  puts "Price is $#{price}"
  puts "Tax is $#{tax}"
  puts "Total price is $#{totalprice}"
  puts "Over 12 months it is $#{totalprice / 12}"

end