Programming Assignment 4 (class assignment 5)
Acme Gas Company has requested a program that simulates the operation of a gas pump. Envision the program is installed in the gas pump and the display is an electronic screen which the customer can see when facing the pump.
At any time during the program's running (the simulation) we should be able to determine, from the pump's display, the price per gallon of gas and the amount remaining in the supply tank from which the gas is being pump.
The pump has a capacity of 500 gallons. A customer may request gas. If a request for gas, in gallons, is less than the amount of gas in the supply tank, the request should be filled; otherwise, only the available amount in the supply tank should be pumped. The customer is not restricted to whole gallons, but may purchase partial gallons. Example: 11.5 gallons of gas. Once the gas is pumped, the total price of the gallons pumped should be displayed and the amount of gas, in gallons, that was pumped should be subtracted from the amount in the supply tank.
Example:
The pump currently has 200 gallons of gasoline. The gasoline is sold at
$1.50 per gallon. A customer requests 10 gallons. Since there
is enough gas in the pump, the request is granted and the display informs the
customer the charge is $15.00. The display also informs the customer that
190 gallons remain.
Your display may look like this:
The gas tank currently has 200 gallons of gasoline
The price per gallon of gas is $1.50
10.00 gallons of gasoline requested
10.00 gallons of gasoline pumped
The total price is $15.00
Please pay inside.
190 gallons remain to be pumped.
Style
This is to be an object oriented program which implements the pump class. You must use the multifile approach (either two files or three). Failure to follow these rules will result in a deduction of up to 10 points (20 percent of grade), depending on the severity of departure of guidelines.
You are required to follow the programming style outlined in the book. Style is very important in the programming world since it helps readability and will aid other programmers in understanding your code. We will follow certain style rules in our class but keep in mind that there are variations found throughout the programming world. The key is to develop a style and then follow it. We will follow a style common to C++ which includes:
Program Name
Your Name
The date the program was completed
Comments describing the purpose of the program
Grading
This program plus flowchart is worth 50 points. The points will be distributed as follows:
| Style | up to 5 points |
| Program compiles | up to 5 points |
| Program produces accurate data | up to 20 points |
| Use of object oriented programming | up to 10 points |
| Use of functions | up to 5 points |
| Flowchart/pseudocode | up to 5 points |
Flowchart
A flowchart is now a required part of your programming. It may be turned in at the same time as your program. The flowchart will be due the Friday prior to the program due date (Nov 10, Monday). It will be submitted via my email address, shalfhill@pjc.edu, with the subject line FLOWCHART
Due Date
The program is due by midnight, Wednesday, Nov 12. Your program should be mailed to my e-mail address, shalfhill@pjc.edu with your program attached. The subject line of your e-mail should read Programming Assignment 4. Submission after midnight, according to PJC's system clock, will receive a 20% deduction for missing a deadline. No late programs will be accepted after Nov 14.
What do you turn in?
Please include your name, phone and e-mail address that I can contact you if I have problems with the program.
Extra Credit
Up to 5 points extra credit for a program which stores all transactions in an array. The user can request a print out of all transactions (assume a maximum of 10 transactions.)
An extra 5 points of extra credit it the array is sorted in either ascending or descending order.
This programming assignment may be corrected or updated. Watch our class website for late breaking details.