Académique Documents
Professionnel Documents
Culture Documents
Direction:
Date due:
2. For the Malaysian ringgit the user obtained as exchange for the US
dollar in Question 1, extend your program so that it will display how
many RM50 notes and RM10 notes a person should receive for a given
amount of money whenever the amount exchange is more than RM 90.
For example, if the amount is RM220, the number of RM50 notes is 4
and the number of RM10 notes is 2. Your program should be able to
reproduce the following sample run:
3. Write a program that can calculate the monthly payment for a loan
amount. Use the following loan payment formula to calculate the loan
monthly payment :
Where
P = principal, the amount of the loan
I = the annual interest rate (from 1 to 100 percent)
L = length, the length (in years) of the loan,
J = monthly interest in decimal form, J = I / (12 x 100)
N = number of months over which loan is amortized, N= L x 12
The input for your program: P, I and L.
The output : M.
5. Write a program that can calculate and display how long it takes to
download a file. To do the calculation, the program will ask the user to
input the size of the file in megabytes (Mb) and the download speed in
Mb per second. The program will then output the download duration (in
hour, minute and second). Sample output (red color indicates value
entered by the user):
6. The Pizza House wants you to write a program that simulates a simple
cash register. The program firstly should ask the user to enter the price
of the meal. Then, the program should calculate the sales tax (8.25% of
the meal price) and add it to the meal price to obtain the total price,
which should be displayed to the user. The program then ask for the
amount tendered (the amount customer gives to pay the bill). After the
user entered the amount tendered, the program should display the
amount tendered, the total price of the meal and the change amount.
7. Write a program that reads in three floating-point numbers and prints the three inputs in sorted
order. For example:
4
9
2.5
2.5
4
9