Purchase Solution

Visual logic flow chart from pseudocode

Not what you're looking for?

Ask Custom Question

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:

Purchase this Solution

Solution Summary

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

Purchase this Solution


Free BrainMass Quizzes
Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Javscript Basics

Quiz on basics of javascript programming language.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.