
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
النسخة 7الرقم المعياري الدولي: 1285225562
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
النسخة 7الرقم المعياري الدولي: 1285225562a. Draw the hierarchy chart and then plan the logic for a program needed by the sales manager of The Henry Used Car Dealership. The program will determine the profit on any car sold. Input includes the sale price and actual purchase price for a car. The output is the profit, which is the sale price minus the purchase price. Use three modules. The main program declares global variables and calls housekeeping, detail, and end-of-job modules. The housekeeping module prompts for and accepts a sale price. The detail module prompts for and accepts the purchase price, computes the profit, and displays the result. The end-of-job module displays the message Thanks for using this program.
b. 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 addition to 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.
الخطوة 1 من21
a.
Hierarchy chart:
The Hierarchy chart explains only how many modules are existed in this program and which modules call others.
The hierarchy chart for the Henry Used car Dealership is shown below:
In the above hierarchy chart,
• The main program calls the three modules such as “housekeeping()”, “detail()”, and “endOfJob()”.
o The housekeeping() module gets the user input of sale cost.
o The detail() module gets the user input of purchase cost, calculates and displays the profit.
o The endOfJob() module displays the message “Thanks for using this program”.
الخطوة 2 من 21
الخطوة 3 من 21
الخطوة 4 من 21
الخطوة 5 من 21
الخطوة 6 من 21
الخطوة 7 من 21
الخطوة 8 من 21
الخطوة 9 من 21
الخطوة 10 من 21
الخطوة 11 من 21
الخطوة 12 من 21
الخطوة 13 من 21
الخطوة 14 من 21
الخطوة 15 من 21
الخطوة 16 من 21
الخطوة 17 من 21
الخطوة 18 من 21
الخطوة 19 من 21
الخطوة 20 من 21
الخطوة 21 من 21
لماذا لم يعجبك هذا التمرين؟
أخرى