Вы находитесь на странице: 1из 7

Software Development Project: Gas Calculation

PRG/210 Fundamentals of Programming with Algorithms and Logic


University of Phoenix

Introduction

The Gas Calculation Project has been awarded to our software development team that in return will
write a program that will calculate the sales of gas at the pumps. This will be done by offering leaded
and unleaded gas along with two offerings, “Gas-n-Go” and “Full-Service”. The purchase of gas,
whether leaded or unleaded needs a calculation of a federal sales tax on the gas purchased only, along
with a calculation of a sales tax that does not include the federal tax amount. In addition to this, if the
customer chooses the “Gas-n-Go” or the “Full-Service” program, those charges are also calculated with
the sales tax on this amount.

Problem Statement

The problem at hand is the issue of creating a program for the customer’s business. The
customer is asking for a program that will calculate the charges that are accumulated through the gas
pump. The program must determine the available option of service as well as type of gasoline being
purchased, and then calculate state and federal taxes to come to a final total. The must be able to
distinguish between options being selected in order to calculate the proper price for service selected,
type of gasoline selected, amount of gasoline and then apply the state and federal taxed for total amount
due to the customer.
When the problem is solved all calculations will be made through the pump giving the customer
options when selection how he/she wished to receive fuel and which type of fuel. State and federal
taxes are applied to every service not matter what service is selected. The program needs to be
versatile enough to work on different locations in order to be used throughout the customer’s company.
The program needs to be as accurate as possible and tested so there are no errors with the
calculations. In order to be up to government regulation the calculations needs to be accurate so that
taxes are not overcharged and the correct amount of gas is being calculated for the customer. Testing
should be done by several individuals to check for accuracy in programming as well as application
functions.
The inputs in this project will be:
• The price of the leaded and unleaded gas.
• The percentage of the federal sales tax.
• The service charge for the “Gas-n-Go” program.
• The service charge for the “Full-Service” program.
The outputs for this project will be:
• The total amount of leaded gas purchased with the federal sales tax calculated.
• The charge of the leaded gas purchase with the sales tax calculated.
• The total amount of the leaded gas purchase sale with no extra service charge.
• The total amount of unleaded gas purchased with the federal sales tax calculated.
• The charge of the unleaded gas purchase with the sales tax calculated.
• The total amount of the unleaded gas purchase sale with no extra service charge.
• The charge of the leaded gas purchased with the federal tax calculated, the service charge of the
“Gas-n-Go” and the sales tax calculated.
• The charge of the unleaded gas purchased with the federal tax calculated, the service charge of
the “Gas-n-Go” and the sales tax calculated.
• The charge of the leaded gas purchased with the federal tax calculated, the service charge of the
“Full-Service” and the sales tax calculated.
• The charge of the unleaded gas purchased with the federal tax calculated, the service charge of
the “Full-Service” and the sales tax calculated.

Processing Steps

Processing steps to produce the required outputs are:


• Leaded Gas Purchase

o # gallons of gas purchased | multiply | leaded gas price | gas price

o # gallons of gas purchased | multiply | federal tax | amount2

▪ If Gas-n-Go, then # gallons of gas purchased | add | charge | total | multiply | sales tax |
amount3

▪ Gas price | add | amount2 | add | amount3 | = Total Bill END

▪ If Full-Service, then # gallons of gas purchased |Add | service charge | total | multiply |
sales tax | amount3

▪ Gas price | add | amount2 | add | amount3 | = Total Bill END

o Otherwise, # gallons of gas purchased | multiply | sales tax | amount3

o Gas price | add | amount2 | add | amount3 | = Total Bill END

• Unleaded Gas Purchase

o # gallons of gas purchased | multiply | unleaded gas price | gas price

o # gallons of gas purchased | multiply | federal tax | amount2

• If Gas-n-Go, then # gallons of gas purchased | add | charge | total | multiply | sales tax |
amount3

• Gas price | add | amount2 | add | amount3 | = Total Bill END

• If Full-Service, then # gallons of gas purchased | add | service charge | total | multiply |
sales tax | amount3

• Gas price | add | amount2 | add | amount3 | = Total Bill END

o Otherwise, # gallons of gas purchased | multiply | sales tax | amount3

o Gas price | add | amount2 | add | amount3 | = Total Bill END

Pseudocode Embedded:
Leaded Gas Purchase
o # gallons of gas purchased | multiply | leaded gas price | amount 1

▪ Read gallons purchased

▪ Read leaded gas price

▪ amount1 = gallons purchased * leaded

o # gallons of gas purchased | multiply | federal tax | amount 2

▪ Read gallons purchased

▪ Get federal tax

▪ amount2 = gallons purchased * tax gas

o If Gas-n-Go, then # gallons of gas purchased | add | charge | total | multiply | sales tax | amount
3

▪ Read gallons purchased

▪ Get charge

▪ Total = gallons purchased + charge

▪ Get sales tax

▪ amount3 = Total * tax sales

o amount 1 | add | amount 2 | add | amount 3 | = Total Bill END

▪ Get amount1

▪ Get amount2

▪ Get amount3

▪ Total Bill = amount1 + amount2 + amount3

o If Full-Service, then # gallons of gas purchased | add | service charge | total | multiply | sales tax
| amount 3

▪ Read gallons purchased

▪ Get service charge

▪ Total = gallons purchased + service


▪ Get sales tax

▪ amount3 = Total * tax sales

o amount 1 | add | amount 2 | add | amount 3 | = Total Bill END

▪ Get amount1

▪ Get amount2

▪ Get amount3

▪ Total Bill = amount1 + amount2 + amount3

o Otherwise, # gallons of gas purchased | multiply | sales tax | amount 3

▪ Read gallons purchased

▪ Get sales tax

▪ amount3 = Total * tax sales

o amount 1 | add | amount 2 | add | amount 3 | = Total Bill END

▪ Get amount1

▪ Get amount2

▪ Get amount3

▪ Total Bill = amount1 + amount2 + amount3

Unleaded Gas Purchase


o # gallons of gas purchased | multiply | unleaded gas price | amount 1

▪ Read gallons purchased

▪ Read unleaded gas price

▪ amount1 = gallons purchased * unleaded

o # gallons of gas purchased | multiply | federal tax | amount 2

▪ Read gallons purchased

▪ Get federal tax

▪ amount2 = gallons purchased * tax gas


o If Gas-n-Go, then # gallons of gas purchased | add | service charge | total | multiply | sales tax |
amount 3

▪ Read gallons purchased

▪ Get charge

▪ Total = gallons purchased + charge

▪ Get sales tax

▪ amount3 = Total * tax sales

o amount 1 | add | amount 2 | add | amount 3 | = Total Bill END

▪ Get amount1

▪ Get amount2

▪ Get amount3

▪ Total Bill = amount1 + amount2 + amount3

o If Full-Service, then # gallons of gas purchased | add | service charge | total | multiply | sales tax
| amount 3

▪ Read gallons purchased

▪ Get service charge

▪ Total = gallons purchased + service

▪ Get sales tax

▪ amount3 = Total * tax sales

o amount 1 | add | amount 2 | add | amount 3 |= Total Bill END

▪ Get amount1

▪ Get amount2

▪ Get amount3

▪ Total Bill = amount1 + amount2 + amount3

o Otherwise, # gallons of gas purchased | multiply | sales tax | amount 3


▪ Read gallons purchased

▪ Get sales tax

▪ amount3 = Total * tax sales

o amount 1 | add | amount 2 | add | amount 3 | = Total Bill END

▪ Get amount1

▪ Get amount2

▪ Get amount3

▪ Total Bill = amount1 + amount2 + amount3

Desk Check:

Line |Leaded Gas Price |Unlead Gas Price |Fed. Tax for Leaded Gas |Fed. Tax for Unlead Gas |# of
Gallons |Gas-n-Go charge |Full-Service Charge |State Sales Tax |Leaded |Service |Price_ Gas |Tax_
Gas |Charge |Sales |Tax_ Sales |Total_ Bill |Condition? |Input/ Output | |1 |4 | | | | | | | | |
| | | | | | | | | |2 | |4.5 | | | | | | | | | | | | | | | | | |3 | | |0.1 | | | | | | | | | | | | | | | | |4 | | | |0.1 |
| | | | | | | | | | | | | | |5 | | | | |15 | | | | | | | | | | | | | | |6 | | | | | |1 | | | | | | | | | | | | | |7 | | |
| | | |2 | | | | | | | | | | | | |8 | | | | | | | |0.05 | | | | | | | | | | | |10 | | | | | | | | | | |0 | | | | | | | |
|11 | | | | | | | | | | | |0 | | | | | | | |12 | | | | | | | | | | | | |0 | | | | | | |13 | | | | | | | | | | | | | |0 |
| | | | |14 | | | | | | | | | | | | | | |0 | | | | |15 | | | | | | | | | | | | | | | |0 | | | |16 | | | | | | | | | | | |
| | | | |Gas is leaded is TRUE | | |16.1 | | | | | | | | |1 | | | | | | | | | | |19 | | | | | | | | | | | | | | | |
|Gas is pumped by customer is FALSE | | |20.1 | | | | | | | | | | | | | | | | |Gas-n-Go ordered is
FALSE | | |20.2.1 | | | | | | | | | | | | | | | | |Full Service is ordered is TRUE | | |20.2.1.1 | | | | | | |
| | |2 | | | | | | | | | |31 | | | | | | | | | | | | | | | | |Leaded = 1 is TRUE | | |31.1 | | | | | | | | | | |
4.00*15 = 60 | | | | | | | | |36 | | | | | | | | | | | | | | | | |Leaded = 1 is TRUE | | |36.1 | | | | | | | | |
| | |0.10*15 = 1.5 | | | | | | | |41 | | | | | | | | | | | | | | | | |Service = 0 is FALSE | | |42.1 | | | | | |
| | | | | | | | | | |Service = 1 is FALSE | | |42.2.1 | | | | | | | | | | | | | | | | |Service = 2 is TRUE | |
|42.2.1.1 | | | | | | | | | | | | |2 | | | | | | |25 | | | | | | | | | | | | | |60 + 2 = 62 | | | | | |46 | | | | | |
| | | | | | | | |62*0.05 = 3.1 | | | | |27 | | | | | | | | | | | | | | | |66.6 | | | |28 | | | | | | | | | | | | | |
| | | |TOTAL BILL IS $66.60 | |

Conclusion

The proposed software development approach described by development team B on the pages above
defines the scope of the project and defines the problem and task Team B is charged with. Developing a
software program to calculate upon customer selection, the type of gas, leaded or unleaded, along with
service type of self, gas-n-go or full service, the program will perform the necessary functions and
calculation to display the correct total charge at the service pump.

To further enhance Team B’s resolve in developing the software proposed, the processing steps have
been clearly defined along with the appropriate Psuedocode and a comprehensive desk check to ensure
algorithm success. It is thus, Team B’s conclusion with successful coding using the proposed course of
processing steps and Psuedocode the software developed for the purpose of providing full customer
service at the pump of a gas station can successfully be completed with minimal risk to errors.

Вам также может понравиться