Draw a typical hierarchy chart for a program that

This preview shows page 3 - 8 out of 26 pages.

4.Draw a typical hierarchy chart for a program that produces a monthly bill for a cell phone customer. Try to think of at least 10 separate modules that might be included. For example, one module might calculate the charge for daytime phone minutes used.5.a. Draw the hierarchy chart and then plan the logic for a program for the sales manager of The Henry Used Car Dealership. The program will determine the profit :
Programming Logic and Design, 7eSolutions 2-4Flowchart: Pseudocode:startDeclarationsnum salePricenum purchasePricenum profitstring SALE_PROMPT = “Enter the sale price: ”string PURCHASE_PROMPT = “Enter the purchase price: ”string END_LINE = “Thanks for using this program”housekeeping()detail()endOfJob()stophousekeeping()main programhousekeeping()detail()endOfJob()
Programming Logic and Design, 7eSolutions 2-5output SALE_PROMPTinput salePricereturndetail()output PURCHASE_PROMPTinput purchasePromptprofit = salePrice - purchasePriceoutput profitreturnendOfJob()output END_LINEreturnb. Revise the profit-determining program so that it runs continuously for any number of cars. The detail loop executes continuously while the sale price is not 0; in additionto calculating the profit, it prompts the user for and gets the next sale price. The end-of-job module executes after 0 is entered for the sale price.Answer: A sample solution is as follows:b. Hierarchy chart: Flowchart: main programhousekeeping()detailLoop()endOfJob()
Programming Logic and Design, 7eSolutions 2-6Pseudocode:startDeclarationsnum salePricenum purchasePricenum profitstring SALE_PROMPT = “Enter the sale price: ”string PURCHASE_PROMPT = “Enter the purchase price: ”string END_LINE = “Thanks for using this program”housekeeping()while salePrice <> 0detailLoop()endwhileendOfJob()stophousekeeping()output SALE_PROMPTinput salePricereturndetailLoop()output PURCHASE_PROMPTinput purchasePrice
Programming Logic and Design, 7e

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture