Java program for a toy car application

Assignment Help Basic Computer Science
Reference no: EM131507087

Write a java program for a Toy Car Application. This Car Control can be used to command a electric toy car to power on, power off, go fast, slow down, turn left and turn right. Create an interface "Controllable" which specifies the following abstract methods: void powerOn(); void powerOff(); void turnRight(); void turnLeft(); void goFaster(); void slowDown(); Define an ElectricCar class that implements the following methods: void powerOn () This method sets a flag to indicate the car is powered on void powerOff () This method sets a flag to indicate the car is powered off. void turnRight() Turns the car by 5 degrees to the right. void turnLeft() Turns the car by 5 degrees to the left void goFaster () Commands the car to move forward and increase the car speed by 2 mph. void slowDown () Commands the car to reduce the speed by 2 mph. String toString() Override this method to output the car information. Use the following main method to test your program: public class ElectricCarApp { public static void main(String[] args) { Controllable toy = new ElectricCar(); toy.powerOn(); toy.goFaster(); toy.turnLeft(); System.out.println(toy); toy.turnLeft(); System.out.println(toy); toy.slowDown(); System.out.println(toy); toy.powerOff(); toy.turnRight(); System.out.println(toy); } } Expected Output: car travels in 355 deg at the speed of 2 mph car travels in 350 deg at the speed of 2 mph car is stopped car is powered off.

Reference no: EM131507087

Questions Cloud

Compare economics of driving miles in car fueled by diesel : We know the standard means of cutting the high cost of driving our automobiles-slow down your speed, no jack rabbit starts, inflate tires properly.
Steps involved in using the jquery library : Briefly describe the steps involved in using the JQuery Library. What advantages does JQuery offer to developer? Illustrate your answer with two examples?
Describe example of another effective approach you have used : Describe example of another effective approach you have used or witnessed. Evaluate the effectiveness of the approach for establishing an effective classroom.
Analyze the sensitivity of the optimal thickness to errorsin : It is desired to determine the most economical thickness of insulation for a large coldstorage room. Insulation is expected to cost $150 per 1,000 square feet.
Java program for a toy car application : rite a java program for a Toy Car Application. This Car Control can be used to command a electric toy car to power on, power off.
Conflict management evaluation : Purpose of each participant at the beginning of the interview and comment on whether or not their purposes were more likely to cause conflict or manage conflict
Developing use cases to support the atm service : As an intern software developer for a retail bank, you have been tasked with developing use cases to support the ATM service.
Discuss the traditional arts and the historical attitude : Discuss the traditional arts and the historical attitude toward art of one of these cultures: India, China, or Japan.
Determine the traffic density on the new road : Abridge is to be constructed now as part of a new road. Engineers have determined that traffic density on the new road will justify a two-lane road.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd