expand icon
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

Edition 7ISBN: 1285225562
book Programming Logic and Design, Introductory 7th Edition by Joyce Farrell cover

Programming Logic and Design, Introductory 7th Edition by Joyce Farrell

Edition 7ISBN: 1285225562
Exercise 9

a. 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.

Step-by-step solution
Verified
like image
like image

Step 1 of 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:

    <div class=answer> 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”.

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”.


Step 2 of 21


Step 3 of 21


Step 4 of 21


Step 5 of 21


Step 6 of 21


Step 7 of 21


Step 8 of 21


Step 9 of 21


Step 10 of 21


Step 11 of 21


Step 12 of 21


Step 13 of 21


Step 14 of 21


Step 15 of 21


Step 16 of 21


Step 17 of 21


Step 18 of 21


Step 19 of 21


Step 20 of 21


Step 21 of 21

close menu
Programming Logic and Design, Introductory 7th Edition by Joyce Farrell
cross icon