Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

java question! Given the following class: public class Person {private String na

ID: 3576230 • Letter: J

Question

java question!

Given the following class: public class Person {private String name; private int age;} Here is a person class, unfortunately if we create a new person they neither have name or an age. Write a constructor that that sets the default name to " Keanu Reeves" and age to 18. Unfortunately, this is not keanu reeves, and naming every person after a guy that doesn't age, would be problematic. Write a constructor that takes a name and an age, then assigns them to the person. Fortunately for you and I people can do a lot more than just exist with a name and an age. They can for example play games! You will need to add a field game, which is a string, and add setters and getters for that field. ANSWER: TODO

Explanation / Answer

public class Person{
   private String name;
   private int age;
   string game;
   public Person(){
       name = "Kanu Reeves";
       age = 18;
   }
   public Person(String name,int age){
       this.name = name;
       this.age = age;
   }
   public void setGame(string game){
       this.game = game;
   }
   public String getGame(){
       return game;
   }
  
}