Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Recently a young member of the family received a remote-controlcar as a present. He used it to terrify the cat, give the dog something to

Recently a young member of the family received a remote-controlcar as a present. He
used it to terrify the cat, give the dog something to chase, andannoy the grownups.
After he went to bed, I took a look at (i.e., played with) the carand the controller. The
controller has five options, turn left, turn right, go forward, goback, and stop.

Hummm. . . looks to me like a good object to simulate, digitally,with a little Java and
some object-oriented programming. So, you are going to build andtest a digital remote-
control car.

Your RCCar (RCCar.java) will have the following class membersexactly.

One variable that will hold the distance the car has traveled. (5points)

Five methods
One method that when called will return a string indicating thatthe car has turned
left. (12 points)
One method that when called will return a string indicating thatthe car has turned
right. (12 points)
One method that when called will return a string indicating thatthe car has
stopped. (12 points)
One method that when called will return an integer value indicatinghow far the
car has travelled forward at the rate of 3 ft/sec. This method willreceive as an argument
an integer value indicating how long the car has been travelingforward. (12 points)
One method that when called will return an integer value indicatinghow far the
car has travelled backwards at the rate of 3 ft/sec. This methodwill receive as an
argument an integer value indicating how long the car has beentraveling backward. (12
points)

Simple, really.

Now let’s write a Java application that will put this little car tothe test. Your Java
application (RCCarTest.java) will do the following.
Instantiate an object of the RCCar class. (10 points)
In a sentinel controlled looping structure the person playing withthe car will have
the following six options (25 points)
Turn left
Turn right
Stop
Go forward for a number of seconds to be determined by theplayer
Go backwards for a number of seconds to be determined by theplayer
End the game

Each time the player selects an option the RC Car object willrespond appropriately to
the player, i.e., if the player selects the turn left option the RCCar will respond with a
“Turning Left” response or something similar that the applicationwill then display to the computer screen. For the go forward and gobackward options the response to the
screen will be something on the order of “Going forward for nnumber of feet” where n is
the number of feet the car traveled in the time allowed. A modestamount of very simple
math will be involved here.

We are nearly at the end of the semester. There are no new conceptsrequired to solve
this problem so I will severely penalize any solutions that havethe following flaws –
? Unnecessary code – If I find any code in your programs that I candelete and your
code still works, it’s unnecessary. (-10 to 50 points)
? Solutions that do not contain, exactly, the class membersindicated above. Missing or
extra methods, missing or extra variables are serious errors. (-50points)
? The loop in the application will, obviously, contain a selectionstructure. I expect the
loop and the selection structure to be clear and simple. Complexityis not your friend
here. (-25 points)

I will always prefer solutions that are clear, simple, void ofunnecessary code, and with
well thought out user interfaces.

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

Computer Performance Engineering 10th European Workshop Epew 2013 Venice Italy September 17 2013 Proceedings

Authors: Maria Simonetta Balsamo ,William Knottenbelt ,Andrea Marin

2013 Edition

3642407242, 978-3642407246

More Books

Students also viewed these Programming questions

Question

Q3: Prove: For any sets A and B, Ax B = B A ?

Answered: 1 week ago

Question

What background experience do you have?

Answered: 1 week ago

Question

Use translations to graph f. f(x) = x-/2 +1

Answered: 1 week ago