Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Develop exactly one class and create three instances john, mary and jane of the class. These three objects share a tank of water with

image text in transcribed
1. Develop exactly one class and create three instances john, mary and jane of the class. These three objects share a tank of water with a capacity of 1234.5 gallons. The class equips three methods. One allows pouring water into the tank, another checks water remaining in the tank, and the other retrieves water out of the tank Declare the amount of gallons of water in the tank as a primitive data field in the class. The water retrieving method not only deducts water out of the tank but also accumulates the usage for individual persons, i.e., flowering (45%) and showering (55%). Provide a main method to start the program execution and model the following behavior. Initialize the tank to have 1200 gallons of water. Next, john pours 95.35 gallons of water into the water tank and then he views the remaining. Later, mary takes away 250.75 gallons. Jane then pours in 100.75 gallons. Afterwards, john retrieved 120.8 gallons and jane retrieved 322.46 gallons. Finally, mary checked the remaining of the tank. At the very end, print out the accumulated water usage for each person in the two usage categories. (2.5 pts)

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_2

Step: 3

blur-text-image_step3

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

More Books

Students also viewed these Databases questions

Question

Outline a literature search strategy.

Answered: 1 week ago

Question

Select suitable tools to analyze service problems.

Answered: 1 week ago