Question: Consider the class given below. CLEARLY answer the questions that follow: public class InnocentTownsperson private boolean is Alive: private boolean isCollege Student; private boolean isTavernKeeper:

Consider the class given below. CLEARLY answer the questions that follow: public class InnocentTownsperson private boolean is Alive: private boolean isCollege Student; private boolean isTavernKeeper: private long timeLeftToLive; public InnocentTownsperson (boolean isCollege Student, long timeLeftToLive) { is Alive = true; this.isCollege Student = isCollege Student; this.isTavernKeeper = !isCollege Student; this.timeleftToLive = timeLeftToLive: } public boolean is Alive() { return isAlive; ) public boolean isCollege Student() { return is College Student; ) public void becomeZombie() { isAlive = false; isCollege Student = false; isTavernKeeper = false; time LeftToLive = 0; } public long getTimeLeftToLive() [ return timeLeftToLive; ) What is the name of this class? What are the attributes of this class? For each attribute, give the data type. What are the behaviors of this class? Write a code fragment to carry out the following tasks: Create an InnocentTownsperson object (make up any data required) . Using the InnocentTownsperson you created, print out a message stating whether or not this person is a college student Make the person into a zombie
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
