Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include using namespace std; class Tank { private: int gallons; public: Tank() { gallons = 50; } Tank(int gal) { gallons = gal; } int

#include using namespace std; class Tank { private: int gallons; public: Tank() { gallons = 50; } Tank(int gal) { gallons = gal; } int getGallons() { return gallons; } }; int main() { Tank storage1, storage2(4.967), storage3(20); cout << storage1.getGallons() << endl << endl; cout << storage2.getGallons() << endl << endl; cout << storage3.getGallons() << endl << endl; return 0; } 

1. Explain the 3 lines of output.

2. Include two mutator functions in the code- one to set the number of gallons for each tank, and one to set the color for each tank. Also write another accessor function to get the colors of the tanks. Then print out accordingly which color of tank has how many gallons. Include your code and the printout you're expecting.

(Note: when you are rewriting the code, you can assume that you're not using any overloaded constructors in your code.)

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

Intranet And Web Databases For Dummies

Authors: Paul Litwin

1st Edition

0764502212, 9780764502217

More Books

Students also viewed these Databases questions

Question

Use internal communication to shine

Answered: 1 week ago

Question

Understand why customers are loyal to a particular service firm.

Answered: 1 week ago