Explore BrainMass

Explore BrainMass

    Visual logic flow chart from pseudocode

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Create visual logic flow chart from the following pseudocode.

    Begin Program:

    //Initialize program variables
    Initialize Regular_Price = 3.00;
    Initialize Premium_Price = 3.20;
    Initialize Fed_Gas_Tax_Regular_Rate = .10;
    Initialize Fed_Gas_Tax_Premium_Rate = .10;
    Initialize Gas_n_Go_Charge = 1.00;
    Initialize Full_Service_Charge = 2.00;
    Initialize State_Sales_Tax_Rate = .05;
    Initialize Gallons;
    Initialize State_Sales_Tax;
    Initialize Fed_Gas_Tax;
    Initialize Gas_Choice;
    Initialize Gas_Cost;
    Initialize Service_Type;
    Initialize Extra_Charge;
    Initialize Total_Cost;

    //User to input the type of gas loaded.
    Display "Enter Type of Gas: Regular or Premium. ";
    Input Gas_Choice;

    //User to input the amount of gas loaded
    Display "Enter amount of gallons: ";
    Input Gallons;

    //User to input the type of service offered to the customer
    Display "Enter type of service rendered: Gas-n-Go, Full-Service, None. ";
    Input Service_Type;

    //Gas cost and federal gas tax for Regular
    If (Gas_Choice == "Regular")
    Gas_Cost = Gallons * Regular_Price;
    Fed_Gas_Tax = Gallons * Fed_Gas_Tax_Regular_Rate;
    //Gas cost and federal gas tax for Premium
    Else if (Gas_Choice = "Premium")
    Gas_Cost = Gallons * Premium_Price;
    Fed_Gas_Tax = Gallons * Fed_Gas_Tax_Premium_Rate;

    //Extra charge for Gas nâ?? Go
    If (Service_Type == "Gas-n-Go")
    Extra_Charge = Gas_n_Go_Charge;
    //Extra charge for Full Service
    Else if (Service_Type == "Full-Service")
    Extra_Charge = Full_Service_Charge;
    //No extra charge if no extra service was given
    Else if (Service_Type == "None")
    Extra_Charge = 0;

    // State Sales Tax
    State_Sales_Tax = State_Sales_Tax_Rate * (Gas_Cost + Extra_Charge);

    // Total Cost to be billed to the customer
    Total_Cost = Gas_Cost + Extra_Charge + State_Sales_Tax + Fed_Gas_Tax;

    //Display of Cost
    Display "Total Gas Cost: ";
    Display Gas_Cost;
    Display "Service Charge: ";
    Display Extra_Charge;
    Display "Federal Gas Tax: ";
    Display Fed_Gas_Tax;
    Display "State Sales Tax: ";
    Display State_Sales_Tax;
    Display "Total Amount: ";
    Display Total_Cost;

    End Program:

    © BrainMass Inc. brainmass.com October 10, 2019, 2:30 am ad1c9bdddf

    Solution Summary

    The solution contains a flow chart of the total gas cost for the given pseudocode