6A PROGRAMSExcellence (6 points): Complete all three programs within 50 hours.
Advanced (5 points): Complete all three programs by the end of Cycle 6. Proficient (4 points): Complete two programs by the end of Cycle 6. Basic (3 points): Complete one program by the end of Cycle 6 and have one program non-functioning. Below Basic (2 points): Complete one program by the end of the cycle. |
|
THIS MODULE'S ALBUMS:
TBD
DoubleDippin
As you continue to work through Cycle 5, I encourage you to utilize procedures in the programs you currently are working on. Get at least one procedure into any Cycle 5 program you have not yet submitted and receive two points for the program in Cycle 5 AND in Module 6A.
Please dropbox this program TWICE: once in it's Cycle 5 location and on this page as well.
As you continue to work through Cycle 5, I encourage you to utilize procedures in the programs you currently are working on. Get at least one procedure into any Cycle 5 program you have not yet submitted and receive two points for the program in Cycle 5 AND in Module 6A.
Please dropbox this program TWICE: once in it's Cycle 5 location and on this page as well.
PLucky7
Way back in module 1E, you wrote a program named Lucky7 in which two dice were displayed for two random numbers and, if they summed to seven, the message "you are lucky" was output.
Open this program, copy the code, and paste it into a new program named PLucky7 (The P is for procedure). Re-write this program so that all of the graphics are within procedures. Now, the main program will likely be quite short--which is the goal of modular programming!
Way back in module 1E, you wrote a program named Lucky7 in which two dice were displayed for two random numbers and, if they summed to seven, the message "you are lucky" was output.
Open this program, copy the code, and paste it into a new program named PLucky7 (The P is for procedure). Re-write this program so that all of the graphics are within procedures. Now, the main program will likely be quite short--which is the goal of modular programming!
FillErUp
Write a program that uses two procedures named Header and Calculate to print a receipt for a gas station. Follow the description below.
Procedure Header; The header should include the station name (such as Morty’s Fill-R-Up), the address (like 1556 N. Main St., Turkleton, WV, 26544), and some kind of a thank you message. The header needs to be in a graphical box of some type.
Procedure Calculate; This should do the calculation work based on the main program inputs for global variables price and gallons. Additionally, a local variable named choice must be declared. For every $50 spent, the user gets a free box of donuts or $3.00 off their gas purchase. The variable choice must be used to help determine what the user wishes to do. Inside this procedure, the global variables subtotal, discount, donuts and total must be calculated.
Main program: Welcome the user, ask for the price of the gasoline he/she would like (store in price) and how many gallons to pump (store in gallons.) Call both procedures when necessary. Print out a nice looking receipt that includes the number of gallons, the price per gallon, the subtotal, the discount, the number of boxes of donuts received, and the total.
TEST DATA:
INPUTS: 2.95 a gallon, 15 gallons of gas
OUTPUTS:
******************************
* Morty's Fill-R-Up *
* 1556 N. Main Street *
* Turkleton, WV 26544 *
******************************
Price Per Gallon: $2.95
Gallons Pumped: 15
Subtotal: $44.25
Discount: $0.00
Boxes of Donuts: 0
Total: $44.25
INPUTS: 3.25 a gallon, 25 gallons of gas, take the donuts
OUTPUTS:
******************************
* Morty's Fill-R-Up *
* 1556 N. Main Street *
* Turkleton, WV 26544 *
******************************
Price Per Gallon: $3.25
Gallons Pumped: 25
Subtotal: $81.25
Discount: $0.00
Boxes of Donuts: 1
Total: $81.25
INPUTS: 3.25 a gallon, 40 gallons of gas, take the discount
OUTPUTS:
******************************
* Morty's Fill-R-Up *
* 1556 N. Main Street *
* Turkleton, WV 26544 *
******************************
Price Per Gallon: $3.25
Gallons Pumped: 40
Subtotal: $130.00
Discount: $6.00
Boxes of Donuts: 0
Total: $124.00
Write a program that uses two procedures named Header and Calculate to print a receipt for a gas station. Follow the description below.
Procedure Header; The header should include the station name (such as Morty’s Fill-R-Up), the address (like 1556 N. Main St., Turkleton, WV, 26544), and some kind of a thank you message. The header needs to be in a graphical box of some type.
Procedure Calculate; This should do the calculation work based on the main program inputs for global variables price and gallons. Additionally, a local variable named choice must be declared. For every $50 spent, the user gets a free box of donuts or $3.00 off their gas purchase. The variable choice must be used to help determine what the user wishes to do. Inside this procedure, the global variables subtotal, discount, donuts and total must be calculated.
Main program: Welcome the user, ask for the price of the gasoline he/she would like (store in price) and how many gallons to pump (store in gallons.) Call both procedures when necessary. Print out a nice looking receipt that includes the number of gallons, the price per gallon, the subtotal, the discount, the number of boxes of donuts received, and the total.
TEST DATA:
INPUTS: 2.95 a gallon, 15 gallons of gas
OUTPUTS:
******************************
* Morty's Fill-R-Up *
* 1556 N. Main Street *
* Turkleton, WV 26544 *
******************************
Price Per Gallon: $2.95
Gallons Pumped: 15
Subtotal: $44.25
Discount: $0.00
Boxes of Donuts: 0
Total: $44.25
INPUTS: 3.25 a gallon, 25 gallons of gas, take the donuts
OUTPUTS:
******************************
* Morty's Fill-R-Up *
* 1556 N. Main Street *
* Turkleton, WV 26544 *
******************************
Price Per Gallon: $3.25
Gallons Pumped: 25
Subtotal: $81.25
Discount: $0.00
Boxes of Donuts: 1
Total: $81.25
INPUTS: 3.25 a gallon, 40 gallons of gas, take the discount
OUTPUTS:
******************************
* Morty's Fill-R-Up *
* 1556 N. Main Street *
* Turkleton, WV 26544 *
******************************
Price Per Gallon: $3.25
Gallons Pumped: 40
Subtotal: $130.00
Discount: $6.00
Boxes of Donuts: 0
Total: $124.00
GoWithTheFlow
Write a program to allow the user to complete any of these flowcharts using a procedure for each question. Play the slideshow to see your options and their point value. Below are the "Starting Questions" for each flowchart.
Snuggies (4 questions, 2 points): Begin at "Do you need a warm and fuzzy blanket?"
Horse (4 questions, 2 points): Begin at " Are you a horse?"
Does it Work (5 questions, 2 points): Begin at "Does it Work?"
Sweatpants (7 questions, 2 points + 1 ABC point): Begin at "Do you have mono?"
Devo (7 questions, 2 points + 1 ABC point): Begin at "Has a problem come along?"
Floor Food (12 questions, 2 points + 2 ABC points): Begin at "Did anyone see you?"
Write a program to allow the user to complete any of these flowcharts using a procedure for each question. Play the slideshow to see your options and their point value. Below are the "Starting Questions" for each flowchart.
Snuggies (4 questions, 2 points): Begin at "Do you need a warm and fuzzy blanket?"
Horse (4 questions, 2 points): Begin at " Are you a horse?"
Does it Work (5 questions, 2 points): Begin at "Does it Work?"
Sweatpants (7 questions, 2 points + 1 ABC point): Begin at "Do you have mono?"
Devo (7 questions, 2 points + 1 ABC point): Begin at "Has a problem come along?"
Floor Food (12 questions, 2 points + 2 ABC points): Begin at "Did anyone see you?"