Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using Java to create the following classes below. For this lab you will create a hierarchy of several classes: iDevice (the parent), iPod, iPad, and

Using Java to create the following classes below.

For this lab you will create a hierarchy of several classes: iDevice (the parent), iPod, iPad, and iPhone.

The parent class iDevice has a non-abstract method called getPurpose() which returns its purposeString. The purpose String instance variable is set in the constructor. The iDevice class also has an abstract method called printDetails() which prints out all of the child classs instance variables.

Child classes of iDevice:

- iPod: the purpose of this iDevice is music - iPad: the purpose of this iDevice is learning - iPhone: the purpose of this iDevice is talking

Note: the child classes also contain instance variables, constructor parameters, accessor methods, and mutator methods for several other data members:

- iPod: (int) number of songs stored, (double) maximum volume in decibels - iPad: (boolean) has a case, (String) operating system version - iPhone: (double) number of minutes remaining on phone plan, (String) carrier

Also, each of these four classes also overrides toString() to return all of the object data in a String. Use the @Override annotation. Child classes toString() methods must also call their parents toString() method.

Furthermore, each of these four classes also overrides equals(). iPods with the same number of songs stored are considered equal; iPads with the operating system version are considered equal; iPhones which have +/- 10 minutes of each others number of minutes remaining on their phone plan are considered equal. Use the @Override annotation.

Extend the iPhone class; it has a child called iPhoneSeven.

The iPhoneSeven class also contains instance variables, constructor parameters, accessor methods, and mutator methods for several other data members:

- (boolean) high-resolution camera - (int) gigabytes of memory

Also, the iPhoneSeven class overrides toString() to return all of the object data in a String. Use the @Override annotation. This toString() method must also call its parents toString() method.

Furthermore, this class also overrides equals(). iPhoneSevens that have +/- 10 minutes of each others number of minutes remaining on their phone plan are considered equal, but only if they also have the same value for high-resolution camera. Use the @Override annotation.

Remember to override hashCode properly too for each class.

And Obviously a Main class(tester).

Please follow the instructions above for a good rate

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional SQL Server 2012 Internals And Troubleshooting

Authors: Christian Bolton, Justin Langford

1st Edition

1118177657, 9781118177655

More Books

Students also viewed these Databases questions

Question

Which of these activities do you support in the business?

Answered: 1 week ago