# B modify the hunterville college program so that the

• Homework Help
• 396
• 95% (19) 18 out of 19 people found this document helpful

This preview shows page 15 - 20 out of 396 pages.

b. Modify the Hunterville College program so that the user enters the rate of tuition increase ins
stop housekeeping() output PROMPT1 input rate output “Current tuition is ”, CURR_TUITION year = 1 tuition = CURR_TUITION return detail() while year <= TOTAL_YEARS tuition = tuition * (1 + rate) output “In ”, year, “ year(s) the tuition will be ”, tuition year = year + 1 endwhile return finishUp() output “End of program” return c. Modify the Hunterville College program so that the user enters the rate of tuition increase for Answer: A sample solution follows Flowchart: Pseudocode: start Declarations num tuition num year num rate num TOTAL_YEARS = 10 num CURR_TUITION = 15000 num PROMPT1 = “Enter the rate of tuition increase for the first year >>” housekeeping() detail() finishUp() stop housekeeping() output PROMPT1
input rate output “Current tuition is ”, CURR_TUITION year = 1 tuition = CURR_TUITION return detail() while year <= TOTAL_YEARS tuition = tuition * (1 + rate) output “In ”, year, “ year(s) the tuition will be ”, tuition year = year + 1 rate = rate + 0.005 endwhile return finishUp() output “End of program” return 12. Yabe Online Auctions requires its sellers to post items for sale for a six-week period during
output PROMPT input price return detailLoop() week = 0 while week < TERM week = week + 1 output week, price price = price * (1 – REDUCTION) endwhile output PROMPT input price return finishUp() output “End of program” return 13. Design a retirement planning calculator for Skulling Financial Services. Allow a user to ente
housekeeping() output PROMPT1 input workingYrs return detailLoop() output PROMPT2 input amtCanSave year = 0 balance = 0 while year < workingYrs balance = balance + amtCanSave balance = balance * (1 + INTEREST_RATE) year = year + 1 endwhile year = 0 while year <= MAX_YRS AND balance > 0 output year, balance balance = balance – SPENDING balance = balance * (1 + INTEREST_RATE) year = year + 1 endwhile return finishUp() output “End of program” return