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.
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...
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](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F6c734197-1b86-4ce4-b8d0-169fc6822d48%2F9b9d0da0-bf6c-4ef1-b383-1a10c21727a7%2F4q8g5iy_processed.jpeg&w=3840&q=75)
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
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Recommended textbooks for you
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
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…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
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)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
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](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY