Question: Create a public static integer field named nextCustomerId and initialize nextCustomerId with 9 0 1 . Ex: If the input is Ari Kim Taj, then

Create a public static integer field named nextCustomerId and initialize nextCustomerId with 901.
Ex: If the input is Ari Kim Taj, then the output is:
Next available ID is 901.
Ari's ID is 901.
Kim's ID is 903.
Taj's ID is 905.
Next available ID is 907. public class Customer {
private String name;
private int id;
public Customer(String newName){
name = newName;
id = nextCustomerId;
nextCustomerId +=2;
}
public void print(){
System.out.println(name +"'s ID is "+ id +".");
}
}

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!