Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java8 programming, convert UML to java code, please explain in detail maxLitres is the total number of litres of water a vessel can hold, litres
Java8 programming, convert UML to java code, please explain in detail
maxLitres is the total number of litres of water a vessel can hold, litres is the current litres of water contained in the vessel.
You are to implement the following. Vessel #litres: double -maxLitres: double +pour(v: Vessel, amount : double): double +fill(amount : double): void +getLitres(): double +getCapacity(): double PlasticCup +pour(v: Vessel, amount : double): double +fill(amount:double): void FilteredJug - number ofUses: int +pour(v: Vessel, amount: double): double +fill(amount:double): void +changeFilter(): void Wine Glass -litres: double -max_litres: double -isBroken: boolean +pour(v: Vessel, amount:double): double +fill(amount:double): void + smash(): void Figure 2: Vessel UML Diagram Each class may contains a specific definition of the methods pour and fill but each method must be usable with other Vessel objects. Each container has at least two attributes, litres and maxLitres. maxLitres is the total number of litres of water a vessel can hold, litres is the current litres of water contained in the vessel. The pour method for each class corresponds to the action of pouring liquid from one vessel to another. If no vessel is specified, then it is assumed the liquid is wasted. This may be necessary if the container contains something contaminated or is smashed. The fill method for each class correspond to the action to adding water to the vessel. The vessel must not exceed the maxLitres specified by the vessel. The following classes have the specified behaviour: FilteredJug contains a filter with a number of uses. If the numberOfUses is > 0, the jug can be filled by other sources. The standard number of uses for a filter is 30, and after the jug has been filled 30 times, the jug must not be able to accept any more water WineGlass is a fragile container and if the glass is broken, it will not be able to hold any water. Therefore if any object attempts to pour water to the wineglass in a brokne state, that water is wastedStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started