Programming Design & Development
Programming Exercise 4-7 (demo)

Introduce The Program (program description)

 

A software company sells a package that retails for $99. Quantity discounts are given according to the following table:

 

Quantity      Discount

10-19         20%

20-49         30%

50-99         40%

100 or more   50%

Design a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount.

(Scroll down for audio clip.)

 

 

<<------ Short Audio Clip

To give you an example. Note: I am using the Gaddis Book titled "Programming Logic and Design". The video says from book page 160 ex 5. It is actually pg 169 ex. 7.

The Title is: "Software Sales".

 

  • Use this audio clip to get you thinking
  • Try your own version of Ch 4 Ex 7 Pg 167

 

 

Gary1.jpg

 

 

Demo the Textbook Approach

Chap4_Prog5.gif

A modified version using RC Computing

(intro to Modules)

Goals:

 


Identify The Modules

Where the separations might go is what you need to consider when setting up modules. We are looking for places we can group things that are similar. Then when we modify code or maybe reuse code it is easier to make the changes because items have similar characteristics. See if you can grasp what I am talking about.

 

Chap4_Prog5_2.gif

 

 

Setup the Main Module

This is an image of the Main Module called (Discount Price) and below it you will see two other modules. One is (Startup) and the other is (Input).

Chap4_Prog5_3.gif

 

 

All Other Modules

Remember, all modules other than the Main Module will start with a call from Main. Notice the title at the top of each flow section is an oval with a name in it. The name is the name of the Module, such as (Process). Once a module hits the (Return) at the bottom it will go back to where it was called from. For example, (Process) will go back to the Main Module once it flows down to the (Return) oval at the bottom.

 

Chap4_Prog5_4.gif

 

Adding file processing techniques (under construction)

Introduce The Program (new improved)

Flowchart Version using RC Computing

Pseudocode Version using RC Computing

(back to the top)

 

Reintroduce The Program as New Improved

(program description)

A software company (Gwinnett Software Inc.) sells a package that retails for $99 a unit. Quantity discounts are given according to the following table:

Quantity

Discount

10-19

20%

20-49

30%

50-99

40%

100 or more  

50%

Design a program that will read data from a data file which includes the customers name, customer number, date of order and the number of packages purchased. The program should then display customers name, customer number, date of order, price before discount, the amount of the discount (if any) and the total amount of the purchase after the discount. Include totals at the bottom of the report for price before discount, amount of the discount and total amount of the purchase after the discount.

 

 

Flowchart Version using RC Computing

(under construction)

 

 

 

 

Pseudocode Version using RC Computing

(under construction)

 

 

 

Summing things up (under construction)