Define a default constructor that initializes the fields age (integer), eyeColor (string), and name (string) with the default values 0, "Unstated", and "Unstated", respectively. Ex: If the input is 63 gray Taj, then the output is: Default values: Age: 0, Eye color: Unstated, Name: Unstated After mutator methods: Age: 63, Eye color: gray, Name: Taj Note: The class's print() method is called before and after the input is passed to the setters. Student.java public class Student {   private int age;    private String eyeColor;    private String name;     /* Your code goes here */   publicvoidsetAge(intstudentAge) { age=studentAge; }   publicvoidsetEyeColor(StringstudentEyeColor) { eyeColor=studentEyeColor; }   publicvoidsetName(StringstudentName) { name=studentName; }   publicvoidprint() { System.out.println("Age: "+age+", Eye color: "+eyeColor+", Name: "+name); } }

Microsoft Visual C#
7th Edition
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Joyce, Farrell.
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 13RQ
icon
Related questions
Question

Define a default constructor that initializes the fields age (integer), eyeColor (string), and name (string) with the default values 0, "Unstated", and "Unstated", respectively.

Ex: If the input is 63 gray Taj, then the output is:

Default values: Age: 0, Eye color: Unstated, Name: Unstated After mutator methods: Age: 63, Eye color: gray, Name: Taj

Note: The class's print() method is called before and after the input is passed to the setters.

Student.java
public class Student {
   private int age;
    private String eyeColor;
    private String name;
 
 
/* Your code goes here */
 
publicvoidsetAge(intstudentAge) {
age=studentAge;
}
 
publicvoidsetEyeColor(StringstudentEyeColor) {
eyeColor=studentEyeColor;
}
 
publicvoidsetName(StringstudentName) {
name=studentName;
}
 
publicvoidprint() {
System.out.println("Age: "+age+", Eye color: "+eyeColor+", Name: "+name);
}
}
 
 
 
AI-Generated Solution
AI-generated content may present inaccurate or offensive content that does not represent bartleby’s views.
steps

Unlock instant AI solutions

Tap the button
to generate a solution

Knowledge Booster
Class
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,