x140 { نظيم كل FACULTY OF ENGINEERING AND INFORMATION TECHNOLOGY DEPARTMENT OF Computer Engineering QUESTION NO. 2: MAND

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

x140 { نظيم كل FACULTY OF ENGINEERING AND INFORMATION TECHNOLOGY DEPARTMENT OF Computer Engineering QUESTION NO. 2: MAND

Post by answerhappygod »

 1
1 (73.03 KiB) Viewed 26 times
x140 { نظيم كل FACULTY OF ENGINEERING AND INFORMATION TECHNOLOGY DEPARTMENT OF Computer Engineering QUESTION NO. 2: MANDATORY/OPTIONAL/BONUS (mants) - a) Suppose a Lamp is described by its color and whether it is turned on or not. Write a class Lamp that contains: > A constructor that creates an object with initial values for color and whether the lamp is on or off, >A print method to print Lamp info with spaces between them. Implement the encapsulation principle. class Lamp Private Strinco lot; islonce venoble public Public Lamp (colub) this.colt colet; } Public boolean (string) if (this color // other color) nultetain/1 else Sit Iloko = returio othekculux e sch Lamp[3 m new Lamp[2]; m[-] = new lamp (ted) mais new Lamp (green) (10 POINTS) AAO-P10-R01 3 2018/9/30 Page 3 of 4 Principles of Object Oriented Programming (110112010) -2 O 12:12 ص 2 © b) Write a testing class that runs creates an array of 2 Lamp objects and then run the print method on the elements of the array. (4 Points) class testy publi't stohc vorp for (Lampen) system.out.println (m). getelice); e ■ (6 Points) 2
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply