Question: Add 2 more Camel objects, but this time ask the user for inputting all the values and then print the info using the getInfo method.

Add 2 more Camel objects, but this time ask the user for inputting all the values and then print the info
using the getInfo method.

/Class Declaration
public class Camel
{
// Instance Variables
int ID;
String name;
int age;
String color;
// method 1
public String getInfo() {
return ("ID of this Camel is: "+ID+" and the name is: "
+ name+".\n It is "+ age + " years old and its color is: " +
color);
}
public static void main(String[] args) {
Camel c1 = new Camel();
c1.ID="379";
c1.name= "The Red One";
c1.age=7;
c1.color="Brown Red";
System.out.println(c1.getInfo());
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To add two more Camel objects and prompt the user for input you can modify the main method as follow... 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!