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

  Where in a max-heap might the smallest element reside

Describe a simple modification to the BST that will allow it to easily support finding the Kth smallest value in Θ(log n) average case time. Then write a pseudo-code function for finding the Kth smallest value in your modified BST.

  Write a program that maintains a database containing data

Write a program that maintains a database containing data

  Future global cyber security issues

Discuss the ethics associated with Future Global Cyber Security Issues. Specifically discuss the ethical issues associated with the implementation of global cybersecurity policy and the interconnectedness of cyber security to society as it relate..

  Elaborate on the following statement

A network architecture, constrained through the incorporation of prior knowledge, addresses the bias-variance dilemma by reducing variance at the expense of increased bias.

  Importance of employees for a company

Given the importance of employees for a company to sustain a competitive advantage, why do you think so many companies have engaged in layoffs, outsourcing, and off-shoring of work to other countries? 200 Words!!!!!

  Rows and columns parameters

Write a complete Java method called get ScoreSheet that takes two ints as parameters (rows and columns) and constructs a 2-dimensional array of doubles (called scores) with a size based on the rows and columns parameters.

  Hardware component of a computer

Which of the following hardware component of a computer can also be called as engine?The sequence of phases, a software goes through from the concept to decommissioning, is called as.

  Multiplexing techniques of dsl and cable modem internet

From the e-Activity, analyze the multiplexing techniques of DSL and cable modem Internet and suggest the one you prefer. Explain your decision.

  Critical success factors of enterprise systems

These 9-10 pages essay (APA) is a synthesis paper on critical success factors for ERP implementations. For this assignment, the general topic (ERP system) has been provided to you - critical success factors of enterprise systems implementations. Y..

  What kinds of solutions might you propose

Consider applying a voice and video over an IP solution for a company interested in enabling its geographically distributed sales force to collaborate efficiently

  Determine the largest couple moment that can be applied

The coefficient of static friction between the belt and the wheel is µ'S=0.2 , and between the belt the peg µ'S=0.4 . The pulley B free to rotate

  Write a business report based on sheltex

Write a business report outlining the case, stating assumptions you make. Provide critique into the management decisions substantiating with reference to literature.

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