Question: JAVA QUESTION. 56. Write a class encapsulating the concept of a television set, assuming a television set has the following attributes: a brand and a

JAVA QUESTION.

56. Write a class encapsulating the concept of a television set, assuming a television set has the following attributes: a brand and a price. Include a constructor, the accessor and mutator, and methods toString and equals. Write a client class to test all the methods in your class. BELOW IS THE CLIENT AND I NEED A TEST CLASS!

public class TVSetClient { public static void main( String [] args ) { TVSet tvs1 = new TVSet( "Sony", 1249.99 ); TVSet tvs2 = new TVSet( "RCA", 999.99 ); System.out.println( "The brand of TV set # 1 is " + tvs1.getBrand( ) ); System.out.println( "The price of TV set # 1 is " + tvs1.getPrice( ) ); System.out.println( "TV set # 2 is " + tvs2.toString( ) );

if ( tvs1.equals( tvs2 ) ) System.out.println( "Original TV sets #1 and #2 are identical" ); else System.out.println( "Original TV sets #1 and #2 are different" );

System.out.println( " Setting TV set #2's brand to Sony and price to 1249.99" ); tvs2.setBrand( "Sony" ); tvs2.setPrice( 1249.99 );

if ( tvs1.equals( tvs2 ) ) System.out.println( "Original TV set #1 and modified TV set #2 are identical" ); else System.out.println( "Original TV set #1 and modified TV set #2 are different" ); } }

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!