Answered step by step
Verified Expert Solution
Link Copied!

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 100 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 while(true)! Shows a menu (see sample output) If the user chooses 1, 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 2, call the rechargeBattery() method. End the loop when the user
chooses 3.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Harness The Power Of Big Data The IBM Big Data Platform

Authors: Paul Zikopoulos, David Corrigan James Giles Thomas Deutsch Krishnan Parasuraman Dirk DeRoos Paul Zikopoulos

1st Edition

ISBN: 0071808183, 9780071808187

More Books

Students also viewed these Databases questions