Chapter 2 Exercises - 5 a Hierarchy Chart main program housekeeping detail endOfJob Pseudocode start Declarations num profit num salePrice num

Chapter 2 Exercises - 5 a Hierarchy Chart main program...

This preview shows page 1 - 3 out of 6 pages.

main program housekeeping() detail() endOfJob() 5. a) Hierarchy Chart Pseudocode start Declarations num profit; num salePrice; num purchasePrice; string SALE_PROMPT = “Enter the sale price: “; string PURCHASE_PROMPT = “Enter the purchase price: “; string END_LINE = “Thanks for using this program”; housekeeping(); detail(); endOfJob(); stop housekeeping(); output SALE_PROMPT; input salePrice; return detail(); output PURCHASE_PROMPT; input purchasePrice; profit = salePrice - purchasePrice; output profit; return endOfJob(); output END_LINE; return
Image of page 1
main program housekeeping() detailLoop() endOfJob() b) Hierarchy Chart Pseudocode start Declarations num profit; num salePrice; num purchasePrice; string SALE_PROMPT = “Enter the sale price: “; string PURCHASE_PROMPT = “Enter the purchase price: “; string END_LINE = “Thanks for using this program”; housekeeping(); while salePrice <> 0 detailLoop() endwhile endOfJob(); stop housekeeping(); output SALE_PROMPT; input salePrice; return detailLoop(); output PURCHASE_PROMPT; input purchasePrice;
Image of page 2
Image of page 3

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture