Test 1 CSCI 151 Version 1
- Duration: 50 minutes
- Open Material, including computer and calculator
- NO CELL PHONES
Question 1 (25 points):
For the program below, answer the following
questions:
- How many variables are in this program?
- For each variable, write NAME, TYPE and VALUE. Provide brief
explanation.
X = "yana"+"bony"
E = 2
K = 3
M = 10%E**K
Question 2 (75 points):
Write a program that reads total amount of the loan taken in the
bank, the down payment, and the loan
tearm (the number of YEARS the loan is taken for).
The program calculates and displays the monthly payment - the amount
user would need to pay every month
to
return the loan.
Examples - use these examples to TEST your program (I rounded answers to display 2 decimal points
only but you are not required to do so)
- Input: loan: $1200, down payment: $200, term: 1 year (pay
attention it is 12 month!)
Output: the monthly payment is $83.33
Input: loan: $1200, down payment: $200, term: 2 year (pay
attention it is 24 month!)
Output: the monthly payment is $41.67
Input: loan: $2000, down payment: $600, term: 3 year (pay
attention it is 36 month!)
Output: the monthly payment is $38.89