Question: how would i write code in java/netbeans for this: You will be creating the driver class for this homework (PA05_TVs.java) and the object/element class, TV.java.
how would i write code in java/netbeans for this:
You will be creating the driver class for this homework (PA05_TVs.java) and the object/element class, TV.java. Your TV class should include only a channel value for instance data (3-99) and the following methods: constructor [requires an initial channel value], getter, setter, randomChannel() [does not return the new channel value], and toString().
The driver class must complete the following:
Instantiate a TV object and set the initial channel to 97.
Instantiate a second TV object and set the initial channel to 63.
Print both the TV objects using a heading for each (ex. TV1: ).
Print a spacer between sets of output.
Set the channel on the first TV to channel 4.
Use the randomChannel method to change the channel on the second TV.
Print both the TV objects using a heading for each.
Be sure to include a message to the screen that explains the purpose of the program to the user as part of a clear statement.
Your output should look similar to this:
The following program creates 2 TV objects and uses the methods to change the channel, get the channel, and print out the TV's information.
TV1: The TV is currently set to channel 97
TV2: The TV is currently set to channel 63
--------------------------------------------------------
TV1: The TV is currently set to channel 4
TV2: The TV is currently set to channel 22
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
