Code:
Start:
//Initialize Variables
Initialize LeadedPrice = user-defined value;
Initialize UnleadedPrice = user-defined value;
Initialize FedGasTaxLeadedRate = user-defined value;
Initialize FedGasTaxUnleadedRate = user-defined value;
Initialize GasnGoCharge = user-defined value;
Initialize FullServiceCharge = user-defined value;
Initialize StateSalesTax_Rate = user-defined value;
Initialize Gallons;
Initialize StateSalesTax;
Initialize FedGasTax;
Initialize GasChoice;
Initialize GasCost;
Initialize ServiceType;
Initialize ExtraCharge;
Initialize TotalCost;
//Enables user to input the type of gas they prefer.
Display "What type of gas would you like? Leaded or Unleaded. ";
Input GasChoice;
//Enables user to input the amount of gas wanted
Display "How many gallons would you like? ";
Input Gallons;
//Enables user to input the type of service they want
Display "Would you like: Gas-n-Go or Full-Service? None. ";
Input ServiceType;
//Calculations of gas cost and federal gas tax for leaded
If (GasChoice == "Leaded")
{
GasCost = Gallons * LeadedPrice;
FedGasTax = Gallons * FedGasTaxLeadedRate;
}
//Calculations of gas cost and federal gas tax for unleaded
Else if (GasChoice = "Unleaded")
{
GasCost = Gallons * UnleadedPrice;
FedGasTax = Gallons * FedGasTaxUnleadedRate;
}
//Cost of extra charge for Gas n’ Go
If (ServiceType == "Gas-n-Go")
ExtraCharge = GasnGoCharge;
//Cost of extra charge for Full Service
Else if (ServiceType == "Full-Service")
ExtraCharge = FullServiceCharge;
//No extra charge if no extra service is wanted
Else if (ServiceType == "None")
ExtraCharge = 0;
//Calculation for State Sales Tax
StateSalesTax = StateSalesTaxRate * (GasCost + ExtraCharge);
//Calculation for the Total Cost to be charged to the customer
TotalCost = GasCost + ExtraCharge + StateSales_Tax + FedGasTax;
//Displays the breakdown of the bill
Display "Total Gas Cost: ";
Display GasCost;
Display "Service Charge: ";
Display ExtraCharge;
Display "Federal Gas Tax: ";
Display FedGasTax;
Display "State Sales Tax: ";
Display StateSalesTax;
Display "Total Amount: ";
Display TotalCost;
Stop:
