Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Written in Java please Task Mortgage java: Write a java program that takes several lines of input from the standard input stream, First line: L-loan

image text in transcribed
Written in Java please
Task Mortgage java: Write a java program that takes several lines of input from the standard input stream, First line: L-loan amount Second line: l-interest rate per period Following lines: reads payments from the standard input stream and shows the result in standard output stream 1. Each payment represents the passage of a single period of the loan 2. For each payment the program computes the interest on the current balance, adds it to the balance, and then subtracts the payment from the balance. The interest is the rate times the balance rounded (ROUND_HALF_UP) to the nearest penny. 3. Each time the string "balance" (regardless of the case) appears in the input the program prints the balance. 4. For a positive balance print the word 'left after the number, for negative balance print 'over', and for zero print 0.00 and nothing afterwards 5. Each payment, and not a balance inquiry, represents one period; no matter how many times the word "balance" appears the number of loan periods does not change. 6. If there are no balance inquiries, then the program has no output Sample Input 100.00 0.01 balance BALANCE In Java Please 10.00 20.00 Balance 100.00 balance Sample Output balance: 100.00 left balance: 100.00 left balance: 71.91 left balance: 27.37 over

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions