Question: [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

[Java] [State Pattern] The RemoteDeviceV1.java implements states of a media player without

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.)

using a State pattern.TestDrive.java is to test RemoteDeviceV1.java. With the State pattern,

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!