# computer science

Category:
Description

You have just purchased a stereo system that cost \$1,000 on the followingcredit plan: no down payment, an interest rate of 18% per year (and hence1.5% per month), and monthly payments of \$50. The monthly payment of\$50 is used to pay the interest and whatever is left is used to pay part of theremaining debt. Hence, the first month you pay 1.5% of \$1,000 in interest. That is \$15 in interest. So, the remaining \$35 is deducted from your debt, which leaves you with a debt of \$965.00. The next month you pay interestof 1.5% of \$965.00, which is \$14.48. Hence, you can deduct \$35.52 (whichis \$50 – \$14.48) from the amount you owe. Write a program that will tell you how many months it will take you to pay off the loan, as well as thetotal amount of interest paid over the life of the loan. Use a loop to calculatethe amount of interest and the size of the debt after each month. (Your finalprogram need not output the monthly amount of interest paid and remain-ing debt, but you may want to write a preliminary version of the programthat does output these values.) Use a variable to count the number of loopiterations and hence the number of months until the debt is zero. You may want to use other variables as well. The last payment may be less than \$50.Do not forget the interest on the last payment. If you owe \$50, then your monthly payment of \$50 will not pay off your debt, although it will comeclose. One month’s interest on \$50 is only 75 cents.

2

The Harris–Benedict equation estimates the number of calories your bodyneeds to maintain your weight if you do no exercise. This is called yourbasal metabolic rate, or BMR. The formula for the calories needed for a woman to maintain her weight isBMR = 655 + (4.3 × weight in pounds) + (4.7 × height in inches) –(4.7 × age in years) The formula for the calories needed for a man to maintain his weight isBMR = 66 + (6.3 × weight in pounds) + (12.9 × height in inches) –(6.8 × age in years) A typical chocolate bar will contain around 230 calories. Write a programthat allows the user to input his or her weight in pounds, height ininches, age in years, and the character M for male and F for female. Theprogram should then output the number of chocolate bars that shouldbe consumed to maintain one’s weight for the appropriate sex of thespecified weight, height, and age.

Before submitting check the following:
– description completely describe the program
– description to user