Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is what i have so far and we are only using MainDriver /* * To change this license header, choose License Headers in Project

image text in transcribed
image text in transcribed
image text in transcribed
this is what i have so far and we are only using MainDriver
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package csc170labs;
/*
* MainDriver.java
* CSC 170 Example code
*/
/**
* Driver class for the Student and Cat classes.
* @author CSC170LAB
*/
import java.util.Scanner;
import java.util.Random;
public class MainDriver {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
String[] augsburgMajors = {"Computer Science" , "Biology","Accounting","MIS","Chemistry","Education","History","Mathematics","Physics","Psychology"};
String[] augsburgDegreeTypes = {"BA" , "BS"};
String[] possibleYears = {"Freshman", "Sophomore", "Junior", "Senior"};
Random randgen = new Random();
Student[] studentArr = new Student[100];
for(int i=0; i
String name = "Student_" + i;
String email = name + "@augsburg.edu";
//Randomly generate major index within 0-9
int majorIndex = randgen.nextInt(9-0+1) + 0;
String major = augsburgMajors[majorIndex];
//Randomly generate degree type index either 0 or 1
int degreeIndex = randgen.nextInt(1-0+1) + 0;
String degreeType = augsburgDegreeTypes[degreeIndex];
//Randomly generate current year index within 0-3
int yearIndex = randgen.nextInt(3-0+1) + 0;
String currentYear = possibleYears[yearIndex];
studentArr[i] = new Student(name, email, major, degreeType, currentYear);
}
//Part a
for(int i=0; i
System.out.println("********************************");
studentArr[i].displayInfo();
}
//Part b
int countBA = 0;
for(int i=0; i
if(studentArr[i].getDegreeType().equals("BA")){
countBA++;
}
}
System.out.println("********************************");
System.out.println("********************************");
System.out.println("Number of students taking BA degrees:" + countBA);
//Part c
System.out.println("********************************");
System.out.println("********************************");
System.out.println("Dean\'s List:");
for(int i=0; i
if(studentArr[i].getGpa() >= 3.5){
System.out.println(studentArr[i].getName());
}
}
//Part d
int threeSemesterCount = 0;
for(int i = 0; i
if(studentArr[i].semestersToGraduate(10)
threeSemesterCount++;
}
}
System.out.println("********************************");
System.out.println("********************************");
System.out.println("Number of students with 3 or fewer semesters to graduate:" + threeSemesterCount);
}
}
Student, cat, and dog java image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
The goal of this lab is to learn the followings: Get familiar with the arrays with classes. Note: This lab does not contain any modifications to Student, Cat and Dog classes. Main Driver Class - Code for all the phases must be in MainDriver class. Your existing code in main method can be either deleted (if you have submitted all the previous labs) or commented. Phase 1: Arrays with Student class: 1. Create the following arrays: Array name Data type Values augsburgMajors String Select any 10 majors from https://www.augsburg.edu/academics/majors/ augsburg DegreeTypes String BA and BS possible Years String Freshman, Sophomore, Junior, Senior 2. Create an array called studentArr to hold 100 Students. 3. Using a loop statement, initialize each element (object reference) in studentArr array using the following constructor defined in Big Lab 3. public Student(String name, String email, String major, String degreeType, String currentYear): Takes the name, major, degreeType, currentYear as parameters and set the instance variables. Set the remaining instance variables to random values. Note: For each student object, generate the constructor's arguments within the loop as follows: name = Student i where i is the loop variable value. email = name@augsburg.edu major = randomly select one major from augsburg Majors array. (Try to derive the logic to randomly select an element from an array!) degreeType = randomly select one degree type from augsburgDegreeTypes array currentYear = randomly select one option from possible Years array, 1 4. Write a separate loop/loops to do the followings: a. Display each student information using displayInfo() method. b. Display the number of students taking BA degrees. c. Display the list of student names in the Dean's list (that is the students with GPA greater than or equals to 3.5). d. Display the number of students who has three or fewer semester to graduate. Assume that the degree length for all the degrees is 10 semesters. Phase 2: Arrays with Cat class 1. Create the following arrays: Array name Data type Values catColors String white, blue, chocolate, cinnamon, lilac, red, cream, and brown 2. Create an array called catArr to hold 50 Cats. 3. Using a loop statement, initialize each element (object reference) in catArr array using the following constructor defined in Big Lab 3. public Cat(String name, String color): Takes the name and color as parameters and sets the instance variables. Set the remaining instance variables to random values Note: For each cat object, generate the constructor's arguments within the loop as follows: name = Cat_i where i is the loop variable value. color = randomly select one color from catColors array. 4. Write a separate loop/loops to do the followings: a. Display the highest purr volume among 50 cats. b. Display the number of declawed cats. c. Display the number of blue cats. d. Display the list of super hungry cats names (hungry instance variable value is 9 or 10) e. Display the name of the oldest cat. 2 Phase 3: Arrays with Dog class 1. Create the following arrays: Array name Data type Values dogColors String black, brown, white, and red 2. Create an array called dogArr to hold 50 Dogs 3. Using a loop statement, initialize each element (object reference) in dogArr array using the following constructor defined in Big Lab 3. public Dog(String name, String color): Takes the name and color as parameters and sets the instance variables. Set the remaining instance variables to random values Note: For each dog object, generate the constructor's arguments within the loop as follows: name = Dog i where i is the loop variable value. color = randomly select one color from dogColors array 4. Write a separate loop/loops to do the followings: a. Display the name of the tallest dog. b. Display the name of the fastest dog. c. Display the number of dogs in each of the four-color categories. That is the number of black dogs, number of brown dogs, ...{Instead of defining four separate counter variables, try to use a parallel array with dog Colors array which stores the count for each color.] d. Display the name of the first brown dog. (Use break statement.) e. Display the information of all the dogs excepts cat chasers. [Use continue statement] f. Find the most common color of the dogs. Phase 4: Comments Add Regular comments in MainDriver class to describe the logic you are using to find each of the above. 3 STUDENT CLASS Represents a Student Includes name, age along with a GPA. @author Asha Abdirazak 7 public class Student Ifinstance variables - data private String name; private int age; private double gpa; private String email: private String major; private String degreeType: private int currentYear; private int currentSemester; private double completed CreditHours; private String studentID; 1/setters and getters /** * Sets the name of this Student * @param name the name for this Student. " public void setName(String name){ this.name = name; > * Returns the name of this student. * @return the name of this Student. */ public String getName(){ return this.name; > * Sets the age of this student. * @param age the age for this Student */ public void setAge(int age) this.age = age; > Returns the age of this student. * @return the age of this student. */ public int getAge return this.age; } 2:0 Returns the age of this student. * @return the age of this student. public int getAgel return this.age: } Sets the grade point average of this student. * @param gpa the grade point average for this Student. * public void setGpa(double gpa) this.gpa = gpa; > * Returns the grade point average of this Student * @return the grade point average of this Student */ public double getGpal return this.gpa; ) public void setEmail(String email) { this.email=email; public String getEmail return this.email: ) public void setMajor ( String Major) ( this.major Major; public String getMajor 04 return this.major; public void setdegreeType (String degreeType) { this.degreeType = degreeType: public String degreeType 0 return this.degreeType: public String getDegreeType() { return degreeType: ) public void setDegreeType(String degreeType) { this.degreeTypes degreeType: > public int getCurrentYear04 return currentYear public void setCurrent Year(int current year) { this.currentYear = currentYear: > public int getCurrent Semester() { return corres 2:0 public int getCurrent Year() { return current Year: > public void setCurrent Year(int currentYear) ( this.currentYear = currentYear; public int getCurrent Semester() { return currentSemester > public void setCurrent Semester (int currentSemester) { this.current Semester = current Semester; public double getCompleted CreditHours() { return completed CreditHours: } public void setCompleted CreditHours(double completedCreditHours) { this.completedCredit Hours completed CreditHours: /" Display the student name, age and grade point average. return nothing. */ public void displayInfo(K System.out.println("Name:" + this.name): System.out.printin("Age:" + this.age); System.out.println("GPA:- + this.gpa); System.out.println("Student ID:*+ this.studenti): public void contacto System.out.println("Name:" + this.name): System.out.println("Email: + this.email); public void studyArea() { System.out.println("Major: "+ this.major); System.out.println("Degree Type"+ this.degreeType); public void degree CompletionEfforto this. public String getStudentID) { return studenti > public void setStudentID(String studentID) { this studenti = studentid; > public int semestersToGraduate(int degreeLength) { return degreeLength - currentYear. 2:0 public String getStudenti0 return studentID: public void setStudentiD(String studentID) { this.studentiD = studentiD: public int semestersToGraduate(int degreeLength) { return degreeLength - currentYear. > public double remaining CreditHours (double required CreditHours) return requiredCreditHours completedCreditHours: } i/ defuit constructor public Student this.name = ""; this.age = 0; this.gpa = 4.0 this.email = "" this.major this.degreeType = ""; this.current Year 0; this.currentSemester = 0; this.completed CreditHours =0.0; this.studentID="* + Il new public Student(String name, String email, String major, String degreeType, String currentYear) { this.name = "Asha"; this.age = 19: this.gpa = 4.0, this.current Semester = 4; this.completed Credit Hours= 66.0; this.studentID = "1111"; ) public Student(String name, int age) { this.name = name; this age = age public Student(String name, int age. String email String major) this.name = name; this.age - age; this.email = email: this.major = major, DOG CLASS 2:0 DOG CLASS author ashaabdirazak "/ Import java.util.Random; public class Dog // instant variables private String name; private int age; private boolean declawed; private double height private double weight; private String color; private int mood; private int hungry: private int energy, private boolean catchaser, private double barkvolume private double growlvolume; private int speed; private int crafitness; // setters and getters public String getName() { return name: } public void setName(String name) { this.name = name; } public int getAge() { return age: public void setAge(int age) { this age = age: } public boolean is Declawed 0 return declawed; public void setDeclawed(boolean declawed) ( this.declawed = declawed; ) public double getHeight() { return height: public void setHeight(double height) { this.height = height: ) public double getWeight return weight; > public void setWeight(double weight) { this.weight = weight: ) public Strip Cold public double getWeight() { 2:0 return weight; public void setWeight(double weight) { this.weight = weight: public String getColor { return color; public void setColor(String color) { this.color = color ) public int getMood() { return mood; > public void setMoodfint mood) { this.mood mood public int getHungryo return hungry: } public void setHungryfint hungry! { this.hungry = hungry: } public int getEnergy return energy: } public void setEnergy(int energy) { this.energy = energy public boolean isCatchaser() { return catchaser public void setCatchaser(boolean catchaser} { this.catchaser = catchaser ) public double getBarkvolume() { return barkvolume; > public void setBarkvolume(double barkvolume) { this.barkvolume = barkvolume ) public double getGrowlvolume() { return growlvolume: 3 public void set Growlvolume (double growlvolume) { this.growlvolume = growlvolume; ) public int getSpeed() { return speed; > public void setSpeedfint speed) { this.speed = speed public int getCrafitness() { return crafitness; } public void 2:0 public void setGrowlvolume (double growlvolume) this.growlvolume = growlvolume; > public int getSpeedo return speed; > public void setSpeedfint speed) { this.speed = speed; > public int getCrafitness() { return crafitness > public void setCrafitness(int crafitness) { this.crafitness = crafitness: new constructors public Dog(String name, String color) { Random randGen-new Random(): this.age = randGen.nextInt(29)+0; this.height= randGen.nextDouble(); this.weight = randGen.nextDouble()+1; this.mood = randGen.nextInt(9)+1; this.hungry = randGen.nextInt(9)+1; this.energy = randGen.nextInt(9)+1; this.catchaser = randGen.nextBoolean(); this.barkvolume = randGen.nextDouble(): this.growlvolume = randGen.nextInt(10)+5; this.speed = randGen.nextInt (9)+1; this.crafitness = randGen.nextInt(9)+1; public void displayinfo System.out.println("Dog information:"); System.out.println("Name:"this.name): System.out.println("Age: "+ this.age); public void Woof() { System.out.println("Woof"); public void play() { mood = this.mood+2; energy = this.energy-1; Woof(: public void sleep energy = this.energy + 2; hungry = this. hungry + 2; public void feed() { mood = this.mood+2; hungry=this.hungry-3; Woof(): * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools Templates * and open the template in the editor. */ package csc1701abs; * Cat.java * csc 170 Example code */ /** * Represents a Cat. * Includes the cat's name, age, and whether it has been declawed. * @author csc170LAB */ public class cat { // instance Variables private String name; private int age; private boolean declawed; 1/setters and getters * Sets the name of this cat. * @param name the name for this Cat. */ public void setName (String name) { this.name = name; } * Returns the name of this Cat. * @return the name of this cat. */ public String getName() { return this.name; } /** * Sets the age of this cat. * @param age the age for this Cat. public void setAge(int age) { this.ace = age: */ public void setName(String name) { this.name = name; } Returns the name of this cat. * @return the name of this Cat. */ public String getName() { return this.name; } Sets the age of this cat. * @param age the age for this cat. public void setAge(int age) { this.age = age; */ * Returns the age of this Cat. * @return the age of this cat. */ public int getAge() { return this.age; } /** Sets the declawed status of this cat. @param declawed whether or not this cat is declawed. */ public void setDeclawed (boolean declawed) { this.declawed - declawed; * Returns whether or not this Cat is declawed. @return true if the cat is declawed, false otherwise. public boolean getDeclawed() { return this.declawed; > * Display the cat name, age and declawed or not. * @return nothing. */ public void displayInfo() { System.out.println("Cat information:"); System.out.println("Name: " + this.name); System.out.println("Age: " + this.age); System.out.println("Declawing? this.declawed); } } The goal of this lab is to learn the followings: Get familiar with the arrays with classes. Note: This lab does not contain any modifications to Student, Cat and Dog classes. Main Driver Class - Code for all the phases must be in MainDriver class. Your existing code in main method can be either deleted (if you have submitted all the previous labs) or commented. Phase 1: Arrays with Student class: 1. Create the following arrays: Array name Data type Values augsburgMajors String Select any 10 majors from https://www.augsburg.edu/academics/majors/ augsburg DegreeTypes String BA and BS possible Years String Freshman, Sophomore, Junior, Senior 2. Create an array called studentArr to hold 100 Students. 3. Using a loop statement, initialize each element (object reference) in studentArr array using the following constructor defined in Big Lab 3. public Student(String name, String email, String major, String degreeType, String currentYear): Takes the name, major, degreeType, currentYear as parameters and set the instance variables. Set the remaining instance variables to random values. Note: For each student object, generate the constructor's arguments within the loop as follows: name = Student i where i is the loop variable value. email = name@augsburg.edu major = randomly select one major from augsburg Majors array. (Try to derive the logic to randomly select an element from an array!) degreeType = randomly select one degree type from augsburgDegreeTypes array currentYear = randomly select one option from possible Years array, 1 4. Write a separate loop/loops to do the followings: a. Display each student information using displayInfo() method. b. Display the number of students taking BA degrees. c. Display the list of student names in the Dean's list (that is the students with GPA greater than or equals to 3.5). d. Display the number of students who has three or fewer semester to graduate. Assume that the degree length for all the degrees is 10 semesters. Phase 2: Arrays with Cat class 1. Create the following arrays: Array name Data type Values catColors String white, blue, chocolate, cinnamon, lilac, red, cream, and brown 2. Create an array called catArr to hold 50 Cats. 3. Using a loop statement, initialize each element (object reference) in catArr array using the following constructor defined in Big Lab 3. public Cat(String name, String color): Takes the name and color as parameters and sets the instance variables. Set the remaining instance variables to random values Note: For each cat object, generate the constructor's arguments within the loop as follows: name = Cat_i where i is the loop variable value. color = randomly select one color from catColors array. 4. Write a separate loop/loops to do the followings: a. Display the highest purr volume among 50 cats. b. Display the number of declawed cats. c. Display the number of blue cats. d. Display the list of super hungry cats names (hungry instance variable value is 9 or 10) e. Display the name of the oldest cat. 2 Phase 3: Arrays with Dog class 1. Create the following arrays: Array name Data type Values dogColors String black, brown, white, and red 2. Create an array called dogArr to hold 50 Dogs 3. Using a loop statement, initialize each element (object reference) in dogArr array using the following constructor defined in Big Lab 3. public Dog(String name, String color): Takes the name and color as parameters and sets the instance variables. Set the remaining instance variables to random values Note: For each dog object, generate the constructor's arguments within the loop as follows: name = Dog i where i is the loop variable value. color = randomly select one color from dogColors array 4. Write a separate loop/loops to do the followings: a. Display the name of the tallest dog. b. Display the name of the fastest dog. c. Display the number of dogs in each of the four-color categories. That is the number of black dogs, number of brown dogs, ...{Instead of defining four separate counter variables, try to use a parallel array with dog Colors array which stores the count for each color.] d. Display the name of the first brown dog. (Use break statement.) e. Display the information of all the dogs excepts cat chasers. [Use continue statement] f. Find the most common color of the dogs. Phase 4: Comments Add Regular comments in MainDriver class to describe the logic you are using to find each of the above. 3 STUDENT CLASS Represents a Student Includes name, age along with a GPA. @author Asha Abdirazak 7 public class Student Ifinstance variables - data private String name; private int age; private double gpa; private String email: private String major; private String degreeType: private int currentYear; private int currentSemester; private double completed CreditHours; private String studentID; 1/setters and getters /** * Sets the name of this Student * @param name the name for this Student. " public void setName(String name){ this.name = name; > * Returns the name of this student. * @return the name of this Student. */ public String getName(){ return this.name; > * Sets the age of this student. * @param age the age for this Student */ public void setAge(int age) this.age = age; > Returns the age of this student. * @return the age of this student. */ public int getAge return this.age; } 2:0 Returns the age of this student. * @return the age of this student. public int getAgel return this.age: } Sets the grade point average of this student. * @param gpa the grade point average for this Student. * public void setGpa(double gpa) this.gpa = gpa; > * Returns the grade point average of this Student * @return the grade point average of this Student */ public double getGpal return this.gpa; ) public void setEmail(String email) { this.email=email; public String getEmail return this.email: ) public void setMajor ( String Major) ( this.major Major; public String getMajor 04 return this.major; public void setdegreeType (String degreeType) { this.degreeType = degreeType: public String degreeType 0 return this.degreeType: public String getDegreeType() { return degreeType: ) public void setDegreeType(String degreeType) { this.degreeTypes degreeType: > public int getCurrentYear04 return currentYear public void setCurrent Year(int current year) { this.currentYear = currentYear: > public int getCurrent Semester() { return corres 2:0 public int getCurrent Year() { return current Year: > public void setCurrent Year(int currentYear) ( this.currentYear = currentYear; public int getCurrent Semester() { return currentSemester > public void setCurrent Semester (int currentSemester) { this.current Semester = current Semester; public double getCompleted CreditHours() { return completed CreditHours: } public void setCompleted CreditHours(double completedCreditHours) { this.completedCredit Hours completed CreditHours: /" Display the student name, age and grade point average. return nothing. */ public void displayInfo(K System.out.println("Name:" + this.name): System.out.printin("Age:" + this.age); System.out.println("GPA:- + this.gpa); System.out.println("Student ID:*+ this.studenti): public void contacto System.out.println("Name:" + this.name): System.out.println("Email: + this.email); public void studyArea() { System.out.println("Major: "+ this.major); System.out.println("Degree Type"+ this.degreeType); public void degree CompletionEfforto this. public String getStudentID) { return studenti > public void setStudentID(String studentID) { this studenti = studentid; > public int semestersToGraduate(int degreeLength) { return degreeLength - currentYear. 2:0 public String getStudenti0 return studentID: public void setStudentiD(String studentID) { this.studentiD = studentiD: public int semestersToGraduate(int degreeLength) { return degreeLength - currentYear. > public double remaining CreditHours (double required CreditHours) return requiredCreditHours completedCreditHours: } i/ defuit constructor public Student this.name = ""; this.age = 0; this.gpa = 4.0 this.email = "" this.major this.degreeType = ""; this.current Year 0; this.currentSemester = 0; this.completed CreditHours =0.0; this.studentID="* + Il new public Student(String name, String email, String major, String degreeType, String currentYear) { this.name = "Asha"; this.age = 19: this.gpa = 4.0, this.current Semester = 4; this.completed Credit Hours= 66.0; this.studentID = "1111"; ) public Student(String name, int age) { this.name = name; this age = age public Student(String name, int age. String email String major) this.name = name; this.age - age; this.email = email: this.major = major, DOG CLASS 2:0 DOG CLASS author ashaabdirazak "/ Import java.util.Random; public class Dog // instant variables private String name; private int age; private boolean declawed; private double height private double weight; private String color; private int mood; private int hungry: private int energy, private boolean catchaser, private double barkvolume private double growlvolume; private int speed; private int crafitness; // setters and getters public String getName() { return name: } public void setName(String name) { this.name = name; } public int getAge() { return age: public void setAge(int age) { this age = age: } public boolean is Declawed 0 return declawed; public void setDeclawed(boolean declawed) ( this.declawed = declawed; ) public double getHeight() { return height: public void setHeight(double height) { this.height = height: ) public double getWeight return weight; > public void setWeight(double weight) { this.weight = weight: ) public Strip Cold public double getWeight() { 2:0 return weight; public void setWeight(double weight) { this.weight = weight: public String getColor { return color; public void setColor(String color) { this.color = color ) public int getMood() { return mood; > public void setMoodfint mood) { this.mood mood public int getHungryo return hungry: } public void setHungryfint hungry! { this.hungry = hungry: } public int getEnergy return energy: } public void setEnergy(int energy) { this.energy = energy public boolean isCatchaser() { return catchaser public void setCatchaser(boolean catchaser} { this.catchaser = catchaser ) public double getBarkvolume() { return barkvolume; > public void setBarkvolume(double barkvolume) { this.barkvolume = barkvolume ) public double getGrowlvolume() { return growlvolume: 3 public void set Growlvolume (double growlvolume) { this.growlvolume = growlvolume; ) public int getSpeed() { return speed; > public void setSpeedfint speed) { this.speed = speed public int getCrafitness() { return crafitness; } public void 2:0 public void setGrowlvolume (double growlvolume) this.growlvolume = growlvolume; > public int getSpeedo return speed; > public void setSpeedfint speed) { this.speed = speed; > public int getCrafitness() { return crafitness > public void setCrafitness(int crafitness) { this.crafitness = crafitness: new constructors public Dog(String name, String color) { Random randGen-new Random(): this.age = randGen.nextInt(29)+0; this.height= randGen.nextDouble(); this.weight = randGen.nextDouble()+1; this.mood = randGen.nextInt(9)+1; this.hungry = randGen.nextInt(9)+1; this.energy = randGen.nextInt(9)+1; this.catchaser = randGen.nextBoolean(); this.barkvolume = randGen.nextDouble(): this.growlvolume = randGen.nextInt(10)+5; this.speed = randGen.nextInt (9)+1; this.crafitness = randGen.nextInt(9)+1; public void displayinfo System.out.println("Dog information:"); System.out.println("Name:"this.name): System.out.println("Age: "+ this.age); public void Woof() { System.out.println("Woof"); public void play() { mood = this.mood+2; energy = this.energy-1; Woof(: public void sleep energy = this.energy + 2; hungry = this. hungry + 2; public void feed() { mood = this.mood+2; hungry=this.hungry-3; Woof(): * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools Templates * and open the template in the editor. */ package csc1701abs; * Cat.java * csc 170 Example code */ /** * Represents a Cat. * Includes the cat's name, age, and whether it has been declawed. * @author csc170LAB */ public class cat { // instance Variables private String name; private int age; private boolean declawed; 1/setters and getters * Sets the name of this cat. * @param name the name for this Cat. */ public void setName (String name) { this.name = name; } * Returns the name of this Cat. * @return the name of this cat. */ public String getName() { return this.name; } /** * Sets the age of this cat. * @param age the age for this Cat. public void setAge(int age) { this.ace = age: */ public void setName(String name) { this.name = name; } Returns the name of this cat. * @return the name of this Cat. */ public String getName() { return this.name; } Sets the age of this cat. * @param age the age for this cat. public void setAge(int age) { this.age = age; */ * Returns the age of this Cat. * @return the age of this cat. */ public int getAge() { return this.age; } /** Sets the declawed status of this cat. @param declawed whether or not this cat is declawed. */ public void setDeclawed (boolean declawed) { this.declawed - declawed; * Returns whether or not this Cat is declawed. @return true if the cat is declawed, false otherwise. public boolean getDeclawed() { return this.declawed; > * Display the cat name, age and declawed or not. * @return nothing. */ public void displayInfo() { System.out.println("Cat information:"); System.out.println("Name: " + this.name); System.out.println("Age: " + this.age); System.out.println("Declawing? this.declawed); } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

(a) What is the complete defining relation? Pg45

Answered: 1 week ago