Question
You design a class named TV. This class needs to have following member variables and member methods: Member Variables private String data field named brand
You design a class named TV. This class needs to have following member variables and member methods: Member Variables private String data field named brand private double data field name weight that specifies the weight (default is zero) private int data field name channel (default is 0) private double data field named frequency (default is 0) Constructors Default constructor: public TV() public TV(int c, String b) with parameter of channel and brand of the TV public TV(int c, String d, double q) (with the channel c, brand d, and frequency of q) Methods The accessor and mutator methods for all four data fields A method named increaseChannel(int n) to increase channel by number n. A method named decreaseChannel(int n) to decrease channel by number n. A method named toString() that returns string description of the TV. You need to implement a TestTV class. In this Test class, you need to create three TV objects (tv1, tv2, and tv3) using different constructors. Change the value of tv1 (created by default) with users input values of title of Samsung, weight of 12 pounds, on channel 40 and with frequency of 120 Hz. Get users input for brand, channel and weight to create tv2 with frequency of 60 using second constructor. After that, get users input for brand, channel and frequency of 120 Hz for tv3, and change tv3s weight to 15 pounds. Display objects by invoking their toString method. Create a class diagram in UML notation.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started