Question: Question: Write a java program includes sub classes, exception handling and a test class with main method. The system should have three classes: Computer. PC

 Question: Write a java program includes sub classes, exception handling and
Question: Write a java program includes sub classes, exception handling and a test class with main method.

The system should have three classes: Computer. PC and Mac. Computer is the parent of other classes. Computer defines certain fields, such as year(int), os_version(string) and brand (string). These variables have their setters and getters defined. PC, has an extra field of OS (string) which can either be 'Linux or Windows'. Use exception handling to prevent other values. Mac has an extra field named Retina (boolean), which is either true or false depending on the display type the Mac has. Once you create these classes write your test class with main method. Create PC and Mac objects, Assign them into a Computer array of 2 elements. Then use a for loop to display their information

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!