P.S - I Will Upvote Correct Answer :) Part a) Write a class called Geniegotchi with: 1. Private data fields: name (of S
Posted: Tue May 24, 2022 7:56 am
P.S - I Will Upvote Correct Answer 
Part a) Write a class called Geniegotchi with:
1. Private data fields: name (of String type, initialized to
“Bob”), endurance (of int type,
initialized to 4) and happiness (of int type, initialized to
3);
2. Public methods:
void setName(String newName) :
renames Genie with newName, prints newName confirmation to
screen;
void genieInfo() :
prints to screen the Genie’s current name, current endurance level
and current
happiness level;
int getEndurance() : returns current endurance;
int getHappiness() : returns current happiness;
void feed() :
this method increases current endurance by 1 if endurance is less
than 10,
otherwise it prints a “No, thanks...” message to the screen;
void play() :
if happiness is less than 10, then this method increases current
happiness by 1 and
decreases current endurance by 2, otherwise it prints a “No,
thanks...” message to
the screen;
Page2
void askFortune() :
if happiness is greater than 6 and endurance is greater than 5
(that is, if your
Genie is happy and healthy enough to predict your fortune...),
then:
– using Math.random(), pick a random number ran between 1 and
100
(inclusive);
– display to the screen the fortune from line number ran in the
fortunes.txt file;
if happiness is greater than 6 but endurance is at most 5,
then:
– display message to screen regarding low endurance;
if endurance greater than 5 but happiness is at most 6, then:
– display message to screen regarding low happiness;
if both endurance and happiness are at most 5 and 6 respectively,
then:
– display message telling user to feed and play with the
Geniegotchi.
Regardless of branch, this method should reduce both endurance and
happiness
by 1.

Part a) Write a class called Geniegotchi with:
1. Private data fields: name (of String type, initialized to
“Bob”), endurance (of int type,
initialized to 4) and happiness (of int type, initialized to
3);
2. Public methods:
void setName(String newName) :
renames Genie with newName, prints newName confirmation to
screen;
void genieInfo() :
prints to screen the Genie’s current name, current endurance level
and current
happiness level;
int getEndurance() : returns current endurance;
int getHappiness() : returns current happiness;
void feed() :
this method increases current endurance by 1 if endurance is less
than 10,
otherwise it prints a “No, thanks...” message to the screen;
void play() :
if happiness is less than 10, then this method increases current
happiness by 1 and
decreases current endurance by 2, otherwise it prints a “No,
thanks...” message to
the screen;
Page2
void askFortune() :
if happiness is greater than 6 and endurance is greater than 5
(that is, if your
Genie is happy and healthy enough to predict your fortune...),
then:
– using Math.random(), pick a random number ran between 1 and
100
(inclusive);
– display to the screen the fortune from line number ran in the
fortunes.txt file;
if happiness is greater than 6 but endurance is at most 5,
then:
– display message to screen regarding low endurance;
if endurance greater than 5 but happiness is at most 6, then:
– display message to screen regarding low happiness;
if both endurance and happiness are at most 5 and 6 respectively,
then:
– display message telling user to feed and play with the
Geniegotchi.
Regardless of branch, this method should reduce both endurance and
happiness
by 1.