Explore BrainMass
Share

Explore BrainMass

    Desk Check Algorithm

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

    This problem has three phases I need help with all three.

    Here is the problem and below the problem is what I have and what I need more assistance with. I specifically need help with the 3rd point and any additional input for point 2.

    Original problem is at the end of this post:

    1. For each program module (component) that was in the simple algorithm that you developed last week, develop an algorithm in pseudo code that shows the tasks and subtasks of the module.

    2. Desk check your algorithms using the following test values:
    - Leaded gas: $4.00/gallon
    - Unleaded gas: $4.50/gallon
    - Federal gas tax: $0.10/gallon
    - Gas-n-Go service charge: $1.00
    - Full-Service charge: $2.00
    - State sales tax: 5%

    3. Create a desk check table to show the results of your desk check test.

    Here is my simple algorithm

    If leaded gas only
    Gallons_of_gas_purchased * cost_of_leaded_gas = cost_1
    cost_1 * fedtax = cost_2
    cost_2 * statetax = cost_3

    If unleaded gas only
    Gallons_of_gas_purchased * cost_of_unleaded_gas = cost_4
    cost_4 * fedtax = cost_5
    cost_5 * statetax = cost_6

    If gas_n_go leaded
    cost_2 + gas_n_go = cost_7
    cost_7 * statetax = cost_8

    If gas n go unleaded
    cost_5 + gas_n_go = cost_9
    cost_9 * statetax = cost_10

    If full service leaded
    cost_2 + fullservice = cost_11
    cost_11 * statetax = cost_12

    If full service unleaded
    cost_5 + fullservice = cost_13
    cost_13 * statetax = cost_14

    Here is step 1. (help from this site last week) ***Please add input if additions are needed

    begin
    Initlalize Leaded gas to 4.00

    Initlalize Unleaded gas to 4.50

    Initlalize Federal gas tax to 0.10

    Initlalize Gas-n-Go service charge to 1.00

    Initlalize Full-Service charge 2.00

    Initlalize State sales tax 0.05
    Read the input choice
    Case of choice
    1 Call LeadedGas()
    2 Call UnleadedGas();
    End case
    end
    //LeadedGas method
    begin
    Declare total
    Calculate total= Leaded gas + Federal gas tax + Gas-n-Go service charge + Full-Service charge + State sales tax;
    Return total
    End

    //method UnleadedGas
    begin
    Declare total
    Calculate total= Unleaded gas + Federal gas tax + Gas-n-Go service charge + Full-Service charge + State sales tax;
    Return total
    end

    ***Need a desk check table for the above***

    Original problem

    develop a program that will calculate a customer's charges and total bill at the gasoline pump, taking into account the following:

    o The per-gallon price for gas is determined by whether the customer purchases leaded or unleaded gasoline.

    o A federal gasoline tax is applied to each gallon of gas, varying by whether the gas is leaded or unleaded.

    o If the customers pump the gas themselves, there are no additional charges apart from state sales tax. If the customers do not pump the gas themselves, one of the following two service charges apply:

    · Gas-n-Go charge: If the customer asks for Gas-n-Go (the station pumps the gas for the customer but performs no other service), a fixed service charge is applied to the bill. The charge does not vary by the amount of gas purchased; the price remains the same whether the customer purchases a half gallon of gas or 10 gallons.

    · Full-Service charge: If the customer asks for Full-Service (the station pumps the gas, checks the oil, checks the air pressure in the tires, and cleans the car windows), a fixed charge is applied to the bill. The charge does not vary by the amount of gas purchased; the price remains the same whether the customer purchases a half gallon of gas or 10 gallons.

    o A state sales tax is applied to the sum of all charges except for the federal gasoline tax.

    © BrainMass Inc. brainmass.com October 9, 2019, 11:43 pm ad1c9bdddf
    https://brainmass.com/computer-science/algorithms/desk-check-algorithm-265917

    Solution Summary

    This solution provides a desk check algorithm.

    $2.19