My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
require 'Loan.rb'

class Input

def gather
print "Enter rate: "
rate = gets

print "Enter months: "
months = gets

print "Enter present value: "
presentValue = gets

print "Payment Schedule (1) or Monthly Payment (2): "
outputFormat = gets

loan = Loan.new(rate.chomp, months.chomp, presentValue.chomp)
if outputFormat.chomp == "1"
schedule = loan.calculatePaymentSchedule
schedule.getPayments.each {|s| puts "#{s.number} --> INTEREST: #{s.interest} PRINCIPLE: #{s.principle} BALANCE: #{s.balance}"}
elsif outputFormat.chomp == "2"
amt = loan.calculateMonthlyPayment
puts amt.to_s
end

end
end

input = Input.new
input.gather

Change log

r54 by pragkirk on Apr 8, 2009   Diff
Initial Checkin
Go to: 
Project members, sign in to write a code review

Older revisions

All revisions of this file

File info

Size: 802 bytes, 31 lines

File properties

svn:executable
Powered by Google Project Hosting