Page 1 of 1

Task 1: Understand the UML diagram (corresponds to the class diagram): With your own words, answer the following questio

Posted: Fri Jul 08, 2022 6:40 am
by answerhappygod
Task 1 Understand The Uml Diagram Corresponds To The Class Diagram With Your Own Words Answer The Following Questio 1
Task 1 Understand The Uml Diagram Corresponds To The Class Diagram With Your Own Words Answer The Following Questio 1 (134.63 KiB) Viewed 38 times
Task 1: Understand the UML diagram (corresponds to the class diagram): With your own words, answer the following questions: ● 1. Why attributes of manufacturer and screen size are defined in an uppercase letter? (Hint: Java language must follow the Java naming convention in defining identifiers) 2. Concerning the concepts of constructor, answer the following: a) Why constructor is a special method in a class? List at least three of the characteristics. b) In the UML diagram, which method is a constructor? And what are the parameters? Task 2: Create and write a new class Create a class named Television and write the class based on the UML diagram. Here are some information: • The manufacturer attribute will hold the brand name. The screensize attribute will hold the size of the television screen. • The power on attribute will hold the value true if the power is on and false if the power is off. c) How constructor is relates with object of class? d) What is a default constructor? Shall every class contains default constructor? e) Differentiate between a constructor and a default constructor. 3. Answer the following which regards to the set () and get () method: a) Define a set () and get () method b) List two characteristics (at least) for each set () and get () method. c) How set () and get () are related? ● The channel attribute will hold the value of the station that the television is showing. • The volume attribute will hold a number value representing the loudness (0 being no sound). . ● The setChannel method will store the desired station in the channel field. • The power method will toggle the power between on and off, changing the value stored in the power on field from true to false or from false to true. The increaseVolume method will increase the value stored in the volume field by 1. + صفحة 2 } 4