Question: Beginner level java please! Geniegotchi! Part a: Write a class called Geniegotchi with: 1. Private data fields: name (of String type, initialized to Bob), endurance

 Beginner level java please! Geniegotchi! Part a: Write a class called Beginner level java please!Geniegotchi with: 1. Private data fields: name (of String type, initialized to"Bob"), endurance (of int type, initialized to 4) and happiness (of int

Geniegotchi! 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 genielnfo) 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; . void askFortune(0: 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

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!