Question: public static class GallonCups { private int gallon; private int cups; //provide default constructor, constructor that takes in gallons and cups in java //getGallon, setGallon,

public static class GallonCups {

private int gallon;

private int cups;

//provide default constructor, constructor that takes in gallons and cups

in java

//getGallon, setGallon, getCups, setCups

public String toString()

{

return gallon + " gallon(s) and " + cups + " cup(s). ";

}

}

public static void main(String[] args) {

Scanner keyboard = new Scanner (System.in);

System.out.println("Enter the number of gallon as a whole number");

int gallon1 = keyboard.nextInt();

System.out.println("Enter the number of cups as a whole number");

int cup1 = keyboard.nextInt();

GallonCups f = new GallonCups(gallon1, cup1);

System.out.println(f);

f.setGallon(4);

f.setCups(112);

System.out.println(f);

}

My code down here

public class GallonCups1 {

/** * @param args the command line arguments */ public static class GallonCups { private int gallon; private int cups; public GallonCups() { } public GallonCups(int g, int c) { while(cups >= 16) } public String toString(){ return gallon +" gallon(s)and"+ cups + " cup(s)."; } public int getCups() { return cups; } public int getGallons() { return gallon; } public void setCups(int c) { cups = c; } public void setGallon(int g) { gallon = g; } public static void main(String[] args) { Scanner keyboard = new Scanner (System.in); System.out.println("Enter the number of gallon as a whole number"); int gallon1 = keyboard.nextInt(); System.out.println("Enter the number of cups as a whole number"); int cup1 = keyboard.nextInt(); GallonCups f = new GallonCups (gallon1, cup1); System.out.println(f); f.setGallon(4); f.setCups(112); System.out.println(f); } } }

//provide default constructor, constructor that takes in gallons and cups

//getGallon, setGallon, getCups, setCups

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!