Write the class specification of a class GasTank containing: A data member named
ID: 3865544 • Letter: W
Question
Write the class specification of a class GasTank containing: A data member named amount of type double (private). A data member named capacity of type double (private). A constructor that accepts a parameter of type double. A function named addGas that accepts a parameter of type double and returns no value. A function named useGas that accepts a parameter of type double and returns no value. A function named isEmpty that accepts no parameters and returns a boolean value. A function named isFull that accepts no parameters and returns a boolean value. A function named getGaslevel that accepts no parameters and returns double. Note that you're NOT asked to implement any member functions yet.Explanation / Answer
Dear Student,
Below i have implemented a class with the given requirement.
----------------------------------------------------------------------------------------------------------------------------------------
//Class Implementation
class GasTank
{
//private data members
private:
double amount;
double capacity;
public:
//This is the constructer with a parameter
GasTank(double parameter)
{
}
//member function add gas with a double parameter and with no return value
void addGas(double parameter)
{
}
//member function useGas with a double parameter and with no return value
void useGas(double parameter)
{
}
//member function isEmpty which has no parameter and boolean return value
bool isEmpty()
{
return;
}
//member function isFull which has no parameter and boolean return value
bool isFull()
{
return;
}
//member function getGasLevel which has no parameter and returns a double value
double getGasLevel()
{
return;
}
}
-----------------------------------------------------------------------------------------------------------------------------------------
Kindly Check and Verify Thanks....!!!
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.