Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

[Java] [State Pattern] The RemoteDeviceV1.java implements states of a media player without using a State pattern . TestDrive.java is to test RemoteDeviceV1.java . With the

[Java] [State Pattern]

The RemoteDeviceV1.java implements states of a media player without using a State pattern.TestDrive.java is to test RemoteDeviceV1.java.

With the State pattern, we get the system with State.java, Playing.java, Paused.java, Stopped.java, and RemoteDevice.java.

This is .java file ===> Incomplete code: drive.google.com/drive/folders/1rwyxvftMv7bIWmu3C69P_gIz6E-dxqmT

image text in transcribed

1) Modify the program TestDrive.java so that it used the new RemoteDevice class.

2) Consider if we want to add a rewind button (this also sets the position back to 0.): Modify the program so that it allows a Rewind state as well as a pressRewind() transition. However, notice that you can only transition to Rewind from Stopped. (Don't forget to set the position back to zero!)

You also have to consider what state to transition to from Rewind. (In other words, once you have rewound the media, what can you do next?) There are a few different ways of accomplishing this, however one strategy is to consider the following hint: It is ok to have a transition from one state to the next that requires no action on the user part (they don't have to press any buttons.)

image text in transcribed

3) What if we added a locked feature to our remote? When the remote is locked, we cannot press any buttons (except to unlock it.) Modify the program so that it provides for a lock.

Press Pause Press Play Playing Paused Pres SeayPress Stop Stopped

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Databases On The Web Learn To Create Web Pages That Interface With Database Engines

Authors: Robert Papaj, Donald Burleson

11th Edition

1576100995, 978-1576100998

More Books

Students also viewed these Databases questions