Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Implementing it! build a software simulation of a DVD player that also has WIFI

ID: 3849511 • Letter: I

Question

Implementing it!

build a software simulation of a DVD player that also has WIFI capability and can connect to Netflix and play streaming video (we will keep it to Netflix at the moment). You are given the complete specification for the remote control until. It is modeled in the Analysis Classification model provided to you. Your task will be:

Implement the classes RemoteControl and DVDPlayer to demonstrate that the remote control can correctly and completely control the DVD player. For output of the DVD player functioning you can either direct status messages to the console, or build a GUI to demonstrate the DVD status. In either case, this is a view and must be totally separate from the DVDPlayer class.

System Requirements:

The remote control has been chosen. The following descriptions provide what is expected behaviour from the DVD player when each button is pressed:

HomeBtn: places the DVD player into home state and displays the home screen. If connected to the inetrnet, the connection is terminated. If a DVD is playing, it is stopped.

InternetBtn: If at home screen and internet service is available, connect to the last internet site visited (ex. Netflix). If there is no last site, go to “list of sites” screen. If no internet service is available, do nothing.

NavRightBtn: Move the cursor display to the right

NavLeftBtn: Move the cursor display to the left

NavUpBtn: Move the cursor display up one line

NavDownBtn: Move the cursor display down one line

PlayBtn: if a DVD is inserted and we are not in internet mode, begin playing the DVD. If

connected to an internet site, play (or select) the highlighted item (ex. Movie)

StopBtn: if playing a DVD, stop playing. If streaming an Internet movie stop and return to the

movie select screen.

PauseBtn: Pause playing the DVD or Internet movie

FFwdBtn: Fast-forward the DVD or Internet movie

FRevBtn: Fast-reverse the DVD or Internet movie

SkipSceneFwdBtn: skip one sceen forward on the DVD; if an internet movie, play in fast-forward

SkipSceneRevBtn: skip one sceen backward on the DVD; if an internet movie, play in fast-reverse

EjectBtn: If a DVD is in the drawer, open the drawer.

CloseDrawerBtn: Close the drawer if open.

OpenDrawerBtn: Open the drawer if closed.

AcceptBtn: (Internet only) Accept the highlighted item on the Internet site

PowerBtn: If DVD is currently ON, turn it OFF. If it is OFF, turn it ON.

Create a Classification implementation model (class model with all supporting attributes and

behavior added) for the DVDPlayer.
o Include all attributes and their data types.
o Include a description of the parameters and behaviour of each method.

Classification Model-Preliminary Remote Control Home Btn Internetetn NavRightBtn Na Left Btn DVDPlayer NavUpBtn NavDownBtn State PlayBtn Stop Btn Pause Btn ProcessRemoteCMD0 E FF wdBtn Display ResultonDisplay() FRevBtn SkipSceneFwdBtn SkipSceneRevBtn EjectBtn Close Drawer tn Open Drawer Btn AcceptBtn PowerBtn DVDSimulationDisplay Send PlayerCMD Display cmd() This model is your starting point. You can continue from here to complete the mode

Explanation / Answer

public class TVRemote implements RemoteControl 02 { 03     private boolean power; 04     private boolean muted; 05     private int MIN_CHANNEL = 2; 06     private int MAX_CHANNEL = 10; 07     private int channel; 08     private int MIN_VOLUME = 0; 09     private int MAX_VOLUME = 10; 10     private int volume; 11 12     public TVRemote() 13     { 14         boolean power = false; 15         muted = false; 16         channel =MIN_CHANNEL; 17         volume = MIN_VOLUME; 18     } 19       20     public boolean getPower() 21     { 22         return power; 23     } 24       25     public boolean getMuted() 26     { 27         return muted; 28     } 29       30     public int getChannel() 31     { 32         return channel; 33     } 34       35     public int getVolume () 36     { 37         return volume; 38     } 39       40     public void powerOnOff() 41     { 42         if (power) 43         volume = muted; 44         else 45         power =! power; 46     } 47       48     public void mute () 49     { 50         if (power) 51         muted =!muted; 52     } 53       54     public void channelUp () 55     { 56         if (power) 57         channel += 1; 58         else 59         return MAX_CHANNEL; 60     } 61       62     public void channelDown() 63     { 64         if (power) 65         channel -=1; 66         else 67         return MIN_CHANNEL; 68     } 69       70     public void volumeUp () 71     { 72         if (power) 73         volume = muted; 74         else 75          if (power) 76          volume +=1; 77          else 78          return MAX_VOLUME; 79     } 80       81     public void volumeDown () 82     { 83         if (power) 84         volume = muted; 85         else 86          if (power) 87          volume +=1; 88          else 89          return MAX_VOLUME; 90     } 91           92 }