# Design a retirement planning calculator for skulling

• 40
• 92% (12) 11 out of 12 people found this document helpful

This preview shows page 21 - 26 out of 40 pages.

11. Design a retirement planning calculator for Skulling Financial Services. Allow a user to enter a number of working years remaining in the user’s career and the annual amount of money the user can save. Assume that the user earns three percent simple interest on savings annually. Program output is a schedule that lists each year number in retirement starting with year 0 and the user’s savings at the start of that year. Assume that the user spends \$60,000 per year in retirement and then earns three percent interest on the remaining balance. End the list after 30 years, or when the user’s balance is 0 or less, whichever comes first.
Programming Logic and Design, 9eSolutions 5-22Pseudocode:
Programming Logic and Design, 9eSolutions 5-23startDeclarationsnum workingYrsnum amtCanSavenum balancenum yearnum INTEREST_RATE = 0.03num SPENDS = 60000num MAX_YRS = 30string PROMPT1 = “Enter the number of working years left in career >> ”string PROMPT2 = “Enter the amount that can be saved per year >> ”housekeepingdetailLoop()endwhilefinishUp()stophousekeeping()output PROMPT1input workingYrsreturndetailLoop()output PROMPT2input amtCanSaveyear = 0balance = 0 while year < workingYrsbalance = balance + amtCanSavebalance = balance * (1 + INTEREST_RATE)year = year + 1endwhileyear = 0while year <= MAX_YRS AND balance > 0output year, balancebalance = balance – SPENDINGbalance = balance * (1 + INTEREST_RATE)year = year + 1endwhilereturnfinishUp()output “End of program”return12. a. Design a program for the Hollywood Movie Rating Guide, which can be installed in a kiosk in theaters. Each theater patron enters a value from 0 to 4 indicating the number of stars that the patron awards to the Guide’s featured movie of the week. If a user enters a star value that does not fall in the correct range, reprompt the user continuously until a correct value is entered. The program executes continuously untilthe theater manager enters a negative number to quit. At the end of the program,
Programming Logic and Design, 9eSolutions 5-24display the average star rating for the movie.Answer: A sample solution followsFlowchart:Pseudocode:startDeclarationsnum numOfStarsnum count = 0num total = 0num avgstring PROMPT = “Enter the star rating or a negative number to quit >> ”housekeeping()while numOfStars >= 0detailLoop()endwhilefinishUp()