Please note global variables are not allowed to use in this assignment except of global constants. GasPump Class A gas pump calculates the cost of gas at a local gas station. The station charges $2.54...


Please note global variables are not allowed to use in this assignment except of global constants.





 GasPump Class


A gas pump calculates the cost of gas at a local gas station. The station charges $2.54 per gallon for regular grade gas, $2.89 per gallon for special grade gas, and $2.99 per gallon for super grade gas. Write a C++ program that create a class named
GasPump
that contains the following private member variables and public member functions:



  • A char member variable named
    gasGrade
    for the grade of the

  • A double member variable named
    numOfGallons
    for the number of

  • A constructor that accepts gas grade and number of gallons as arguments, and assign them to the appropriate member

  • A
    void
    function named
    cost()
    that calculates the cost of the purchase based on the gas grade selected and the number of gallons The function then display the following information aboutthe purchase, for example:


“Your purchase is 38 gallons Regular grade gas at $2.54 per gallon.”


“Your payment is $96.52.”



In the main function, prompts the user to enter the gas grade and the number of gallons, and then creates a
GasPumobject and displays the purchase details by calling the
cost()
function.



Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here