A class called watertank – Two data members.

This C++  assignment entails creating a class called watertank. A water tank has two data members: current volume and maximum capacity. Create appropriate constructors, mutators, and accessors to support the tank’s function.

A class called watertank – Two data members.

The first assignment. Create a class called watertank. A watertank has two data members: current volume and maximum capacity. So, create appropriate constructors, mutators, and accessors to support the tank’s function. Among these, create a fill() member function to allow water to be added to the simulated tank. Create a drain() member function to allow water to flow from the tank. Create an isempty() member function to indicate true if the current volume is 0 and false otherwise. Additionally, overload following operators: • > allows two watertank objects to be compared. Also, returns true if the first object has more current volume than the second. • < allows two watertank objects to be compared and also, returns true if the first object has less current volume than the second.

A class called watertank – Two data members.

• == allows two watertank objects to be compared and returns true if the first object has less current volume than the second. Create at least two watertank objects in the main function. Assign a current volume and maximum capacity to each. Also, demonstrate the use of fill(), drain(), isempty() and compare the two objects using >,<, and ==. The second The function AddFactor is similar to the factorial function for integers. AddFactor (N) = 1 + 2 + 3 + …+ N. AddFactor(0) = 0 and AddFactor(1) = 1. Write recursive representation of this function and a program that takes user input to demonstrate the use of the function.

Additional Files

order now with paypal
Powered by WordPress