Answered step by step
Verified Expert Solution
Question
1 Approved Answer
We are going to get our Robot working. The Robot blueprint has two instance variables, the robot name and the current battery level. The class
We are going to get our Robot working. The Robot blueprint has two instance variables, the robot name and the current battery level. The class should have the following methods they must have the signature above: A constructor that has two parameter a String containing the name of the Game and a int that sets the current battery level. An empty constructor A toString A method performTask that takes in the task name and the amount of battery required for that task. The method removes that much battery if it is available. If not, it indicates so and does not complete the task. A method rechargeBattery that just resets the level to A method isBatteryLow that is a boolean. Used to check the battery level. Getters and setters at the bottom Write a RobotDriver program that creates a Robot object and then loops DO NOT use a whiletrue Shows a menu see sample output If the user chooses ask for the task and the amount of battery needed. Call the performTask method on the object. Check to see if the battery is low using the isBatteryLow and if it is let the user know it is low do not automatically recharge it If the user chooses call the rechargeBattery method. End the loop when the user chooses
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started