Question: how can i get user input with this code of how many cup cakes each stand sold public class Main { //This is a instance

how can i get user input with this code of how many cup cakes each stand sold

public class Main {  //This is a instance variables  int ID;  int soldedCupCakes;  static int totalCupCakes;      public  Main (int ID, int soldedCupCakes) {  this.ID = ID;  this.soldedCupCakes = soldedCupCakes;  totalCupCakes = totalCupCakes + soldedCupCakes;  }    // This is a method just solded method  public void JustSolded() {  // increment soldedCupCakes  soldedCupCakes++;  //This is a increment totalCupCakes  totalCupCakes++;  }    // This is a return soldedCupCakes  public int numberOfCupCakes() {  return soldedCupCakes;  }    //This is a  return totalCupCakes  public static int totalNumberOfCupCakesSolded() {  return totalCupCakes;  }    @Override  public String toString() {  return "Bakery stand # " + ID + " has solded " + soldedCupCakes + ", All stands together solded " + totalCupCakes  + " cupcakes.";  }    public static void main(String[] args) {  // create BakeryStand objects   Main  bakeryStand1 = new  Main (1, 3);  // call JustSolded  bakeryStand1.JustSolded();   Main bakeryStand2 = new  Main (2, 6);  // print details using toString method  System.out.println(bakeryStand1);  System.out.println(bakeryStand2);    }    }

Step by Step Solution

3.50 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To get user input for the number of cupcakes each stand sold you can use the Scanner class in Java H... View full answer

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 Programming Questions!