Answer a sample solution is as follows a hierarchy

This preview shows page 3 - 7 out of 20 pages.

displays the message “Thanks for using this program”.Answer: A sample solution is as follows:a. Hierarchy chart: Flowchart: Pseudocode:startDeclarationsnum wholesalePricenum retailPricenum profitstring WHOLE_PROMPT = “Enter the wholesale price”string RETAIL_PROMPT = “Enter the retail price”main programhousekeeping()detail()endOfJob()
Programming Logic and Design, 6eSolutions 2-4string END_LINE = “Thanks for using this program”housekeeping()detail()endOfJob()stophousekeeping()output WHOLE_PROMPTinput wholesalePricereturndetail()output RETAIL_PROMPTinput retailPriceprofit = retailPrice - wholesalePriceoutput profitreturnendOfJob()output END_LINEreturnb. Revise the profit-determining program so that it runs continuously for any number of items. The detail loop executes continuously while the wholesale price is not 0; in addition to calculating the profit, it prompts the user for and gets the next wholesale price. The end-of-job module executes after 0 is entered for the wholesale price.Answer: A sample solution is as follows:b. Hierarchy chart: Flowchart: main programhousekeeping()detailLoop()endOfJob()
Programming Logic and Design, 6eSolutions 2-5Pseudocode:startDeclarationsnum wholesalePricenum retailPricenum profitstring WHOLE_PROMPT = “Enter the wholesale price”string RETAIL_PROMPT = “Enter the retail price”string END_LINE = “Thanks for using this program”housekeeping()while not wholesalePrice = 0detailLoop()endwhileendOfJob()stophousekeeping()output WHOLE_PROMPTinput wholesalePricereturndetailLoop()output RETAIL_PROMPTinput retailPrice
Programming Logic and Design, 6eSolutions 2-6profit = retailPrice - wholesalePriceoutput profitoutput WHOLE_PROMPTinput wholesalePricereturnendOfJob()output END_LINEreturn6.a. Draw the hierarchy chart and then plan the logic for a program that calculates the gown size a student needs for a graduation ceremony. The program uses three

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture