Question: STUDENT CLASS /** * Represents a Student. * Includes name, age along with a GPA. * @author Asha Abdirazak */ public class Student{ //instance variables

 STUDENT CLASS /** * Represents a Student. * Includes name, agealong with a GPA. * @author Asha Abdirazak */ public class Student{

//instance variables - data private String name; private int age; private double

gpa; private String email; private String major; private String degreeType; private int

STUDENT CLASS

/** * Represents a Student. * Includes name, age along with a GPA. * @author Asha Abdirazak */

public class Student{ //instance 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 completedCreditHours; private String studentID; //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; }

/** * 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 getGpa(){ 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 () { return this.major; } public void setdegreeType (String degreeType) { this.degreeType = degreeType; } public String degreeType () { return this.degreeType; }

public String getDegreeType() { return degreeType; }

public void setDegreeType(String degreeType) { this.degreeType = degreeType; }

public int getCurrentYear() { return currentYear; }

public void setCurrentYear(int currentYear) { this.currentYear = currentYear; }

public int getCurrentSemester() { return currentSemester; }

public void setCurrentSemester(int currentSemester) { this.currentSemester = currentSemester; }

public double getCompletedCreditHours() { return completedCreditHours; }

public void setCompletedCreditHours(double completedCreditHours) { this.completedCreditHours = completedCreditHours; }

/** * Display the student name, age and grade point average. * @return nothing. */ public void displayInfo(){ System.out.println("Name: " + this.name); System.out.println("Age: " + this.age); System.out.println("GPA: " + this.gpa); System.out.println("Student ID: "+ this.studentID); } public void contact() { 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 degreeCompletionEffort() { this. }

public String getStudentID() { return studentID; }

public void setStudentID(String studentID) { this.studentID = studentID; } public int semestersToGraduate(int degreeLength) { return degreeLength - currentYear; } public double remainingCreditHours (double requiredCreditHours){ return requiredCreditHours - completedCreditHours; } // defult constructor public Student() { this.name = ""; this.age = 0; this.gpa = 4.0; this.email = ""; this.major = ""; this.degreeType = ""; this.currentYear =0; this.currentSemester = 0; this.completedCreditHours =0.0; this.studentID = ""; } // new public Student(String name, String email, String major, String degreeType, String currentYear) { this.name = "Asha"; this.age = 19; this.gpa = 4.0; this.currentSemester = 4; this.completedCreditHours= 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

/** * * @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 isDeclawed() { 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 String getColor() { return color; }

public void setColor(String color) { this.color = color; }

public int getMood() { return mood; }

public void setMood(int mood) { this.mood = mood; }

public int getHungry() { return hungry; }

public void setHungry(int 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; }

public void setGrowlvolume(double growlvolume) { this.growlvolume = growlvolume; }

public int getSpeed() { return speed; }

public void setSpeed(int 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(); } }

CSC 170L-A/B/C Introduction to Object-Oriented Programming (Java) Labs Big Lab #4 (Due at 11:59 PM, Monday, February 22, 2021) The goal of this lab is to learn the followings: Get familiar with the if-else, switch-case, and loop statements . * Phase 1 - Modifying the Student class Add the following method. degree Completion Effort(): Calculate the remaining credits to complete as 128.0 - completedCreditHours. Calculate the remaining semesters to complete as 10- currentSemester Calculate the credits per future semester as remaining credits/ remaining semesters. Display messages as follows: Message to display Condition for credits per future semester less than or equals to 10.0 greater than 10.0 but less than or equals to 20.0 greater than 20.0 but less than or equals to 28.0 greater than 28.0 You may graduate early. You are in the right phase of completing your degree. You will have to work hard to complete the degree on time. It is nearly impossible to graduate on time. Add JavaDoc comments in the Student class based on the newly added method. CSC 170L-A/B/C Introduction to Object-Oriented Programming (Java) Labs * Phase 2 - Modifying the Cat class . Modify the following methods: play() - If the energy becomes negative once decreases by 1, set it to 0. feed() - If the hungry becomes negative once decrease by 3, set it to O . Add the following methods. todayCatMood(): Display the following messages based on the cat's mood instance variable. Mood value Message 1 Scared 2 Happy 3 Sad 4 Sleepy 5 Playful 6 Anxious 7 Agitated 8 Aggressive 9 Furious 10 Affectionate feedsUntilNoHunday(): Count and return the number of times you need to feed the cat (call the feed method) to make the cat's hungry go away (hungry instance variable is 0). Note: Use a loop statement. gainFullEnergyAfterPlayAnd Sleep(): Count and return the number of times it takes to fully gain the energy after play and sleep cycles for a cat as follows: Until the energy is 10, - Generate a random number between 1-10. If the random number is even, call the play() method. If the random number is odd, call the sleep() method. Increase the count by 1. Note: Use a loop statement. Add or modify the JavaDoc comments in the Cat class based on the newly added/modified methods. CSC 170L-A/B/C Introduction to Object-Oriented Programming (Java) Labs * Phase 3 - Modify the Dog class . Add the following method: speedLevel(): Display the following messages based on the dog's speed instance variable. Speed Message 1 Super slow 2,3 Slow 4,5,6 Normal speed 7,8 Faster than average 9 Very fast 10 Superfast . Add or modify the JavaDoc comments in the Dog class based on the newly added method. * Phase 4 - Modify the Main Driver class Create an object of the Cat class in the main method using the constructor defined in BigLab03: public Cat(String name, String color). You can set the name, color to any value (no need to take user input) . Create an object of the Dog class in the main method using the constructor defined in BigLab03: public Dog(String name, String color). You can set the name, color to any value (no need to take user input) . Calculate the followings: Cat Win Score = (((meow Volume * craftiness) / (ageFactor)) * (speed + clawFactor) o where, ageFactor = Max of (absolute value of (age - 5) and 1) [/The max replaces with 1 If Cat has claws, clawFactor = 2 If Cat does not have claws, clawFactor = 0 Dog Win Score = (growlVolume * craftiness) * speed * 4 CSC 170L-A/B/C Introduction to Object-Oriented Programming (Java) Labs Assume we are having a competition between the Cat and the Dog. Display the winner of the competition using the rules below: Dog is NOT a cat chaser AND Cat purrs louder than Dog Growls --> Cat Wins Dog is NOT a cat chaser AND Cat has claws AND Cat is craftier than Dog--> Cat Wins Dog is NOT a cat chaser AND Cat meows louder than Dog Barks --> Cat Wins Dog is NOT a cat chaser AND Cat is younger than 2 --> Cat Wins Dog is NOT a cat chaser and all of the above options are not true --> Dog Wins Dog Is a cat chaser AND Dog Win Score is greater than Cat Win Score (margin of error .05) --> Dog Wins Dog Is a cat chaser AND Cat Win Score is greater than Dog Win Score (margin of error .05) --> Cat Wins Dog IS a cat chaser AND Dog Win Score is the same as the Cat Win Score (margin of error .05) --> TIE - Modify the above to demonstrate the competitions between 1000 Cats and 1000 Dogs with the same name and color. Calculate and display the winning percentage of the Cats and the Dogs

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!