Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA 5. [40 points] Use the following UML diagram and the partially completed code for the class Bottle Complete the code a. [10 points] Add

JAVA

image text in transcribed

5. [40 points] Use the following UML diagram and the partially completed code for the class Bottle Complete the code a. [10 points] Add the properties b. [10 points] Implement the getter for the property filled c. [10 points] Finish the constructor Bottle(double, String). Make it verify that the unit is "oz" or "cc", and sets it to "oz" if not. d. [10 points] Finish the method fill(double amount) The parameter amount represents the amount of liquid to be added to the bottle. The property filled represents the amount of liquid already in the bottle. Make the method verify that the bottle will not overflow. The bottle can be filled to capacity but no more public class Bottlef //Properties go here. public Bottle (double size, String unitH //Finish this constructor Bottle size double filled: double unit String Bottle) + Bottle(size : dauble) Bottle(size : dauble, unit: String) fill(amoun: double) + getSize() : double + getFilled() : double + getUnit) String public Bottle (double size) thi(size"): public Bottle () this (16.0, "oz") public double getsizel) freturn size:) public String getunit) return unit:i //Implement a getter for filled here public void fillidouble amount) /Finish this method here

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_2

Step: 3

blur-text-image_3

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

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions

Question

What personnel decisions must Lindy face to improve her business?

Answered: 1 week ago

Question

=+e. Storytelling present product in a story.

Answered: 1 week ago