Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The system should have three classes: Instrument, Keyboard and Guitar. Instrument is the parent of other classes. Instrument defines certain fields, such as year(int), condition(string)

The system should have three classes: Instrument, Keyboard and Guitar. Instrument is the parent of other classes.

Instrument defines certain fields, such as year(int), condition(string) and brand (string). These variables have their setters and getters defined.

Keyboard, has an extra field of numberOfKeys(int).

Guitar has an extra field named numberOfStrings which can be 4,6 or 7. Any other values must be rejected. Use exception handling to prevent other values.

Once you create these classes write your test class with main method. Create Keyboard and Guitar objects, receive the values from the user and use exception handling for input mismatch. Assign them into an Instrument array of 2 elements. Then use a for loop to display their information.

Java*

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

Excel As Your Database

Authors: Paul Cornell

1st Edition

1590597516, 978-1590597514

More Books

Students also viewed these Databases questions