Work on the following: Create three interfaces with the names "InterfaceOne," "IrnterfaceTwo," and "In In the first interface, decdare a method (signature only) with a name "updateGea In the second interface, dedare a method (signature only) with a name "acceler In the third interface, decdare a method (signature only) with a name "pushBrak Create two classes Car and Truck that implement these three interfaces at one E new method "currentSpeed()" in both the classes to find the current speed afte Define all the three methods inside each class. The data to these methods will E during the object creation.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
Draw
Design
Layout
References
Mailings
Review
View
Help
Create a Java program and name your file: FIRSTNAME. java (for example, lohn.java).
Work on the following:
Create three interfaces with the names "InterfaceOne," "IrnterfaceTwo," and "Interfacelhree"
In the first interface, declare a method (signature only) with a name "updateGear()."
In the second interface, dedare a method (signature only) with a name "accelerate()."
In the third interface, dedare a method (signature only) with a name "pusherake()."
Create two classes Car and Truck that implement these three interfaces at one time. Define a
new method "currentSpeed()" in both the classes to find the current speed after the brake.
• Define all the three methods inside each class. The data to these methods will be provided
during the object creation.
Invoke the two objects with a name c1 of class Car and t1 of class Truck.
• After creating the objects, call all the three methods defined above in both the classes.
Pass any of the following integer values to the three functions one by one:
updateGeart): 1 to 5, For example: cl.updateGear(3);
accelerate(): 1 to 4, For example: t1.accelerate(4);
pushBrake(): 1 to 3, For example: t1.pushBrake(2)
Note: To find the current speed in "currentSpeed()," subtract the push brake value from
accelerate value which were passed to "accelerate()" and "pushBrake()" methods.
Print the Gear value, current speed, and brake value for both Car and Truck.
DFocu
Transcribed Image Text:Draw Design Layout References Mailings Review View Help Create a Java program and name your file: FIRSTNAME. java (for example, lohn.java). Work on the following: Create three interfaces with the names "InterfaceOne," "IrnterfaceTwo," and "Interfacelhree" In the first interface, declare a method (signature only) with a name "updateGear()." In the second interface, dedare a method (signature only) with a name "accelerate()." In the third interface, dedare a method (signature only) with a name "pusherake()." Create two classes Car and Truck that implement these three interfaces at one time. Define a new method "currentSpeed()" in both the classes to find the current speed after the brake. • Define all the three methods inside each class. The data to these methods will be provided during the object creation. Invoke the two objects with a name c1 of class Car and t1 of class Truck. • After creating the objects, call all the three methods defined above in both the classes. Pass any of the following integer values to the three functions one by one: updateGeart): 1 to 5, For example: cl.updateGear(3); accelerate(): 1 to 4, For example: t1.accelerate(4); pushBrake(): 1 to 3, For example: t1.pushBrake(2) Note: To find the current speed in "currentSpeed()," subtract the push brake value from accelerate value which were passed to "accelerate()" and "pushBrake()" methods. Print the Gear value, current speed, and brake value for both Car and Truck. DFocu
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY