Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1.9 YouTrylt: Jug Create a class called Jug that represents a jug of liquid. The UML for this class is shown below. Jug private String
1.9 YouTrylt: Jug Create a class called Jug that represents a jug of liquid. The UML for this class is shown below. Jug private String liquidType private int gallons public Jugo public JugeString type, int gab public void setGallons public int getGallonso public String gettiquidType public boolean IsEmpty . . Your class should have the following private state liquidType (a string) gallons (an integer) Your class should have the following constructors. A default constructor that creates an empty jug of water. A constructor that accepts the type of liquid the jug contains, and the number of gallons the jug contains, in that order. Your class should have the following behaviors . Amethod called setGallons that allows you to set the number of gallons in the jug. A method called getGallons that allows you to get the number of gallons in the jug. A method called getLiquidtype that allows you to get the type of liquid in the jug. A method called asEmpty that returns true if the jug is empty and false otherwise . 219273.971002 LAB ACTIVITY 1.9.1: You Trylt Jug 0/10 Submission Instructions Downloadable files Jug.java Download Compile command savac Jug-java -Xlint:all -encoding utf-8 We will use this command to compile your code Upload your files below by dragging and dropping into the area or choosing a file on your hard drive. Jug.java Drag file here or Choose on hard drive. 1 2 3 Jug.java public class Jug { public static void main(String args[]) { // you can use this to test your class // but this will not be used by the grader... } 4 5 6 7 8 // state... 10 11 // constructors... 12 V/ behaviors... 13 14. }
Step 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