Question: Create a public static method named getNextWheelId ( ) that returns the value of the private static integer field nextWheelId. public class Tricycle { private
Create a public static method named getNextWheelId that returns the value of the private static integer field nextWheelId. public class Tricycle
private static int nextWheelId ;
private int numTricycles;
private int startId;
private int endId;
public Tricycleint newSize
numTricycles newSize;
startId nextWheelId;
endId startId numTricycles ;
nextWheelId numTricycles ;
public void print
System.out.printnumTricycles tricycles need ;
System.out.printnumTricycles wheels and the wheels are assigned with IDs from ;
System.out.printlnstartId to endId ;
Your code goes here
import java.util.Scanner;
public class NewTricycles
public static void mainString args
Scanner scnr new ScannerSystemin;
System.out.printlnNext available ID is Tricycle.getNextWheelId;
Tricycle tricycle new TricyclescnrnextInt;
Tricycle tricycle new TricyclescnrnextInt;
Tricycle tricycle new TricyclescnrnextInt;
tricycleprint;
tricycleprint;
tricycleprint;
System.out.printlnNext available ID is Tricycle.getNextWheelId;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
