Explore BrainMass

Visual logic flow chart from pseudocode

This content was STOLEN 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 25, 2018, 4:29 am ad1c9bdddf

Solution Summary

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

See Also This Related BrainMass Solution

Create a HIPO Chart, Flowchart, Decision Table, and Pseudocode for the program.

Now that you have a program design and a chosen programming language for your project, you can begin looking at the logical flow of the processes within your program and the data that is input, modified, and/or output.

You have seen graphical tools used to represent these processes such as flowcharts, HIPO charts, and Decision Tables, but you thought until now that they were a waste of time. Since there are many processes and conditions involved in this program, you definitely do see the need for these graphical and textual representations.

Using the UML diagram and variable list agreed upon by the group, create a HIPO Chart, Flowchart, Decision Table, and Pseudocode for the program.

View Full Posting Details