Go4Expert (http://www.go4expert.com/)
-   Programming (http://www.go4expert.com/forums/programming-forum/)
-   -   Help with psuedocode, please?? (http://www.go4expert.com/forums/help-psuedocode-t26862/)

holiks 6Oct2011 23:04

Help with psuedocode, please??
hello everyone, I wrote the following code but I have a hard time with psuedocode opposed to actual programming code so I'm not sure I correctky wrote this in psuedocode or not. Can someone please help me and let me know if this is actually correct psuedocode


//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;

All times are GMT +5.5. The time now is 13:46.