SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 313 Weeks Ago, 6 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 04 Dec 2017 My Price 8.00

java program for a Toy Car Application Car Control

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

Answers

(5)
Status NEW Posted 04 Dec 2017 06:12 AM My Price 8.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)