Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please use code provided to compleate. The program needed should be using JAVA a

ID: 3868412 • Letter: P

Question

Please use code provided to compleate.

The program needed should be using JAVA and it should compile a list of instruments from different instrument families. A family of musical Instruments is a grouping of several different but related sizes or types of instruments. Please comment some families are: (See the included partial code at the below(need that code compleated as instructed in the comments in the code)

package midweek9;
//Imports
import java.util.Scanner;
//Begin Class Week13_Skeleton

public class midweek9 {

    static String instrument = null;
    static String iName;
    static String cont = null;

    /**
     * New Scanner object
     */
    static Scanner sc = new Scanner(System.in);

    /**
     * New Subclass objects. Brass is complete. Woodwinds, Strings, and Percussion
     * must be added
     */
    static Brass_Skeleton brass = new Brass_Skeleton(instrument);//Brass_Skeleton is one of the external

    //Begin Main Method
    public static void main(String[] args) {

        /*Variable Declarations*/
        int choice;
        String dispInt;

        System.out.println("Select one of the following instrument families:");
        do {
            System.out.print("1. Brass 2. String 3. Woodwind 4. Percussion 5. Display all instruments 6. Exit ->: ");
            choice = sc.nextInt();
            switch (choice) {
                case 1:
                    /*set iName = to the type of instrument. Example: iNmae = "brass"*/
                    /*call a method within the main class to enter the instrucment using iName*/
                    break;
                /*add case blocks for addition instrument types as required*/
                /*add case block to call display instruments method*/
                /*add exit and default case bloks*/
            }
            System.out.print("Display instrucments? (Y for Yes, N for No)->: ");
            dispInt = sc.next();
            if (dispInt.equalsIgnoreCase("y")) {
                /*call display instruments method*/
                /*call goodbye method*/
            } else {
                /*call goodbye method*/
            }
        } while (cont.equalsIgnoreCase("Y"));
    } //End Main Method

    /**
     * Method GoodBye: used to say goodbye. Common for several calls
     */
    private static void GoodBye() {
        System.out.print("Enter more instrucments? (Y for Yes, N for No)->: ");
        cont = sc.next();
        if (cont.equalsIgnoreCase("n")) {
            System.out.println("Goodbye");
            System.exit(0);
        }
    }

    /**
     * Method enterInst: Used to set instruments
     *
     * @param instName
     */
    private static void enterInst(/*declare variable to receive instrument type name*/) {
        int numInts;
        System.out.printf("How many %s instruments would you like to enter?->: ", /*instrument type name variable*/);
        numInts = sc.nextInt();
        /*Begin for loop to enter instruments.*/
        for (int i = 0; i < numInts; i++) {
            System.out.printf("Enter instrument #%d->: ", i + 1);
            instrument = sc.next();
            switch (/*instrument type name variable*/) {
                case "brass":
                    brass./*call public set method in brass subclass while sending instrument entered*/(instrument);
                    break;
                /*add case blocks for additional instrument types. will be like brass above*/
                /*add default block*/
            }
        }
    }

    /**
     * Method displayInstruments: Used to display results
     */
    private static void displayInstruments() {

        brass./*call how to play overloaded method in brass subclass*/
        /*add calls to other three types of instruments. will be like brass above*/
               

    } //End Main Method

} //End Class Midweek9

package midweek9;
Imports

//Begin Subclass BlownInstrument_Skeleton
abstract class BlownInstrument_Skeleton extends Instrument_Skeleton{
    protected String blown;
} //End Subclass BlownInstrument_Skeleton

package midweek9                                               

//Imports
import java.util.ArrayList;
//Begin Subclass Brass_Skeleton

class Brass_Skeleton extends BlownInstrument_Skeleton {

    /*declare a local ArrayList of type String to hold entered instruments*/

    Brass_Skeleton(/*declare String variable for brass instrument*/) {
        /*declare super with no arguments*/
        /*declare this name and set equal to variable declared for brass instrument*/
        this.blown = " is played by mouth.";
    }

    public void setInts(String bI) {
        /*arraylist name from above*/.add(bI);
    }

    public ArrayList<String> getInts() {
        return /*arraylist name from above*/;
    }

    @Override
    public void howToPlay() {
        for (String array : getInts()) {
            System.out.println("The " + array + " is a brass instrument and" + blown);
        }
    }
} //End Subclass Brass_Skeleton

//Imports
//Begin Subclass Instrument_Skeleton
abstract class Instrument_Skeleton {

    protected String name;

    abstract public void howToPlay();
} //End Subclass Instrument_Skeleton

Brass Family - A brass instrument is a musical instrument that produces sound by sympathetic vibration of air in a tubular resonator in sympathy with the vibration of the player's lips.
Ref:https://en.wikipedia.org/wiki/Brass_instrument (Links to an external site.)Links to an external site.

Strings Family - String instruments, stringed instruments, or chordophones are musical instruments that produce sound from vibrating strings.
Ref:https://en.wikipedia.org/wiki/String_instrument (Links to an external site.)Links to an external site.

Woodwind Family - Woodwind instruments are a family of musical instruments within the more general category of wind instruments. There are two main types of woodwind instruments: flutes and reed instruments (otherwise called reed pipes). What differentiates these instruments from other wind instruments is the way in which they produce their sound.
Ref:https://en.wikipedia.org/wiki/Woodwind_instrument (Links to an external site.)Links to an external site.

Percussion Family - A percussion instrument is a musical instrument that is sounded by being struck or scraped by a beater (including attached or enclosed beaters or rattles); struck, scraped or rubbed by hand; or struck against another similar instrument.
Ref:https://en.wikipedia.org/wiki/Percussion_instrument (Links to an external site.)Links to an external site.

Constraints

Limit the number of families to the list above

Use one separate (external to the main class) abstract superclass: Instrument

Use three separate (external to the main class) abstract subclasses that extend Instrument:

o BlownInstrument
o Fingered
o Struck

Use four separate (external to the main class) subclasses (families) that extend the appropriate three above:

o Brass
o Strings
o Woodwind
o Percussion

Requirements

Display the menu shown in the downloadable PDF example

Request the number of instruments to be entered

All instruments should be placed into an array (you can use one array per family or one array for all entered) so they may be displayed

Use set and get methods where appropriate

Implement a loop that will allow the user to enter more instruments

Use exception handling and validation where appropriate

Expected Output---User input is in BOLD

Select one of the following instrument families:

1. Brass

2. String

3. Woodwind

4. Percussion

5. Display all instruments

6. Exit

->: 1

How many brass instruments would you like to enter? ->: 3

Enter instrument #2->: bugle

Enter instrument #2->: trumpet

Enter instrument #3->: tuba

Display instruments? (Y for Yes, N for No)->: n

Enter more instruments? (Y for Yes, N for No)->: y

1. Brass

2. String

3. Woodwind

4. Percussion

5. Display all instruments

6. Exit

->: 2

How many string instruments would you like to enter? ->: 2

Enter instrument #1->: guitar

Enter instrument #2->: harp

Display instruments? (Y for Yes, N for No)->: n

Enter more instruments? (Y for Yes, N for No)->: y

1. Brass

2. String

3. Woodwind

4. Percussion

5. Display all instruments

6. Exit

->: 3

How many wood wind instruments would you like to enter? ->: 2

Enter instrument #1->: clarinet

Enter instrument #2->: oboe

Display instruments? (Y for Yes, N for No)->: n

Enter more instruments?

Explanation / Answer

// for accepting and display the instruments name
package midweek9;

import java.util.Scanner;

public class midweek9 {
static String instrument = null;
static String iName;
static String cont = null;
//New Scanner object

static Scanner sc = new Scanner(System.in);
/**
* New Subclass objects. Brass is complete. Woodwinds, Strings, and Percussion
* must be added
*/
static Brass_Skeleton brass = new Brass_Skeleton(instrument);//Brass_Skeleton is one of the external
static string_Skeleton string_ins = new string_Skeleton(instrument);
static woodWind_Skeleton woodWind = new woodWind_Skeleton(instrument);
static percussion_Skeleton percussion = new percussion_Skeleton(instrument);
//Begin Main Method
public static void main(String[] args) {
/*Variable Declarations*/
int choice;
String dispInt;
System.out.println("Select one of the following instrument families:");
do {
System.out.print("1. Brass 2. String 3. Woodwind 4. Percussion 5. Display all instruments 6. Exit ->: ");
choice = sc.nextInt();
String iName;
switch (choice) {
case 1:// if choice is brass instrument
iName = "brass";
enterInst(iName);
break;
case 2://if choice is string instrument
iName = "string";
enterInst(iName);
break;
case 3: //if choice is woodwind instrument
iName = "woodWind";
enterInst(iName);
break;
case 4: //if choice is percussion instrument
iName = "Percussion";
enterInst(iName);
break;
case 5: // if choice is to display the instrument
displayInstruments();
break;
}
System.out.print("Display instrucments? (Y for Yes, N for No)->: ");
dispInt = sc.next();
if (dispInt.equalsIgnoreCase("y")) {
displayInstruments();
GoodBye();
} else {
GoodBye();
}
} while (cont.equalsIgnoreCase("Y"));
} //End Main Method
private static void GoodBye() {
System.out.print("Enter more instrucments? (Y for Yes, N for No)->: ");
cont = sc.next();
if (cont.equalsIgnoreCase("n")) {
System.out.println("Goodbye");
System.exit(0);
}
}
private static void enterInst(String insType) {
int numInts;
System.out.printf("How many %s instruments would you like to enter?->: " ,insType);
numInts = sc.nextInt();
/*Begin for loop to enter instruments.*/
for (int i = 0; i < numInts; i++) {
System.out.printf("Enter instrument #%d->: ", i + 1);
instrument = sc.next();
switch (insType) {
case "brass":
brass.setInts(instrument);
break;
case "string":
string_ins.setInts(instrument);
break;
case "woodWind":
woodWind.setInts(instrument);
break;
case "percussion":
percussion.setInts(instrument);
break;
}
}
}
/**
* Method displayInstruments: Used to display results
*/
private static void displayInstruments() {
brass.howToPlay();
string_ins.howToPlay();

} //End Main Method
} //End Class Midweek9

// class for brass instrument
package midweek9;

import java.util.ArrayList;
//Begin Subclass Brass_Skeleton
class Brass_Skeleton extends BlownInstrument_Skeleton {
/*declare a local ArrayList of type String to hold entered instruments*/
ArrayList<String> arraylist = new ArrayList<String>();
  
Brass_Skeleton(String blown) {
  
this.blown = " is played by mouth.";
}

  
public void setInts(String bI) {
/*arraylist name from above*/
arraylist.add(bI);
}
public ArrayList<String> getInts() {
return arraylist /*arraylist name from above*/;
}

public void howToPlay() {
for (String array : getInts()) {
System.out.println("The " + array + " is a brass instrument and" + blown);
}
}
} //End Subclass Brass_Skeleton
// string instrument class
package midweek9;

import java.util.ArrayList;
//Begin Subclass string__Skeleton
class string_Skeleton extends Fingered {
/*declare a local ArrayList of type String to hold entered instruments*/
ArrayList<String> arraylist = new ArrayList<String>();
  
string_Skeleton(String blown) {
  
this.blown = " is played by hands.";
}

  
public void setInts(String bI) {

arraylist.add(bI);
}
public ArrayList<String> getInts() {
return arraylist ;
}

public void howToPlay() {
for (String array : getInts()) {
System.out.println("The " + array + " is a String instrument and" + blown);
}
}
} //End Subclass string_Skeleton

//class for woodWind
package midweek9;

import java.util.ArrayList;
//Begin Subclass woodWind_Skeleton
class woodWind_Skeleton extends struckInstrument {
/*declare a local ArrayList of type String to hold entered instruments*/
ArrayList<String> arraylist = new ArrayList<String>();
  
woodWind_Skeleton(String blown) {
  
this.blown = " is played by mouth.";
}

  
public void setInts(String bI) {
/*arraylist name from above*/
arraylist.add(bI);
}
public ArrayList<String> getInts() {
return arraylist /*arraylist name from above*/;
}

public void howToPlay() {
for (String array : getInts()) {
System.out.println("The " + array + " is a brass instrument and" + blown);
}
}
}//end subclass woodWind_Skeleton

//class for percussion instrucments
package midweek9;

import java.util.ArrayList;

class percussion_Skeleton extends BlownInstrument_Skeleton {

ArrayList<String> arraylist = new ArrayList<String>();
  
percussion_Skeleton(String blown) {
  
this.blown = " is played by hands.";
}

  
public void setInts(String bI) {
  
arraylist.add(bI);
}
public ArrayList<String> getInts() {
return arraylist ;
}

public void howToPlay() {
for (String array : getInts()) {
System.out.println("The " + array + " is a String instrument and" + blown);
}
}
} //End Subclass percussion_Skeleton

package midweek9;


//Begin Subclass Instrument_Skeleton
public abstract class Instrument_Skeleton {
protected String name;
abstract public void howToPlay();
} //End Subclass Instrument_Skeleton

package midweek9;

abstract class BlownInstrument_Skeleton extends Instrument_Skeleton{
protected String blown;
} //End Subclass BlownInstrument_Skeleton

//fingered abstract
package midweek9;

abstract class Fingered extends Instrument_Skeleton{
protected String blown;
} //End Subclass FingeredInstrument_Skeleton
// struck abstract
package midweek9;
abstract class struckInstrument extends Instrument_Skeleton{
protected String blown;
} //End Subclass struckInstrument

sample output is:
run:
Select one of the following instrument families:
1. Brass
2. String
3. Woodwind
4. Percussion
5. Display all instruments
6. Exit
->: 1
How many brass instruments would you like to enter?->: 1
Enter instrument #1->: tuba
Display instrucments?
(Y for Yes, N for No)->: y
The tuba is a brass instrument and is played by mouth.
Enter more instrucments?
(Y for Yes, N for No)->: y
1. Brass
2. String
3. Woodwind
4. Percussion
5. Display all instruments
6. Exit
->: 2
How many string instruments would you like to enter?->: 2
Enter instrument #1->: guitar
Enter instrument #2->: harp
Display instrucments?
(Y for Yes, N for No)->: y
The tuba is a brass instrument and is played by mouth.
The guitar is a String instrument and is played by hands.
The harp is a String instrument and is played by hands.
Enter more instrucments?
(Y for Yes, N for No)->: y
1. Brass
2. String
3. Woodwind
4. Percussion
5. Display all instruments
6. Exit
->: 3
How many woodWind instruments would you like to enter?->: 2
Enter instrument #1->: clarinet
Enter instrument #2->: oboe
Display instrucments?
(Y for Yes, N for No)->: n
Enter more instrucments?
(Y for Yes, N for No)->: n
Goodbye
BUILD SUCCESSFUL (total time: 2 minutes 16 seconds)