Answer to Question #271246 in C++ for sam

Question #271246

Define a class called vehicle that will store two items of information about a vehicle: The fuel capacity and the fuel consumption in kilometers per litre and prototype of four functions a default constructor and a parameterized constructor that initializes the Taxi fuel capacity to 20 litres and Taxi consumption to 10 kpl , a destructor and a friend function that uses the values from the constructors to calculates the taxi range (the maximum distance it would travel if its fuel tank is full without refueling) NB. Show only the prototype of the function in the class


1
Expert's answer
2021-11-26T07:08:43-0500
#include <iostream>


using namespace std;


class vehicle{
  private:
    int fuelCapacity;
    int fuelConsumption;
    
  public:
    vehicle(){
        
    }
    vehicle(int cap,int con){
        fuelCapacity=20;
        fuelConsumption=10;
    }
    void setFuelCapacity(int cap);
    void setFuelConsumption(int con);
    int getFuelCapacity();
    int getFuelConsumption();
    friend void calculate();
    ~vehicle(){
        
    }
};
int main()
{
    vehicle v;


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS