Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need the answer in C++ and I need a Watertank.h file and Watertank.cpp file. Create a class called watertank. A watertank has two data

I need the answer in C++ and I need a Watertank.h file and Watertank.cpp file.

Create a class called watertank. A watertank has two data members: current volume and maximum capacity. Create appropriate constructors, mutators, and accessors to support the tanks 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 be removed 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 and returns true if the first object has more current volume than the second.
  • < allows two watertank objects to be compared and returns true if the first object has less current volume than the second.
  • == 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. Demonstrate the use of fill(), drain(), isEmpty() and compare the two objects using >, <, and ==.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions