Construct 4 instances of your instrument

Assignment Help JAVA Programming
Reference no: EM13692226

Question: Create a class named MusicalInstrument and its four subclasses named Woodwind, Brass, String and Percussion.

The MusicalInstrument has a name, isPlaying, and isTuned data fields. It also has methods for setting and getting the values of each of the fields along with a method to display how the instrument is played.

A constructor that sets the isTuned and isPlaying fields to false is also included in the MusicalInstrument class.

You are welcome to add additional data fields and methods if you like.

Finally, create a Java test class that simulates using your MusicalInstrument class.  In your test class you should at a minimum:

1) Construct 4 instances of your instrument,

2) tune your instruments,

3) print the name of your instrument

4) print how you play your instrument 

In order to exercise polymorphism, please declare in the test class an array with 4 elements of type MusicalInstrument, and populate it with objects of each of the subclasses.

Include comments in code section. Code this in java programming.

Reference no: EM13692226

Questions Cloud

What do you recommend he do about making a backup : What do you recommend he do about making a backup - The chief financial officer (CFO) of NCWR keeps a huge number of reports, spreadsheets, and other critical financial information on his computer
How many data links will there be along : How many data links will there be along the way when Host R transmits a packet to Host S - How many routes?
Explain how you can extend the sci capability : Explain how you can extend the SCI capability to RF and Bluetooth communication - Imagine an RFID device connected to SCI0 that sends a 16 character code to the DB-12 board when an item is swiped
Determine if the given subset is a subspace : Determine if the given subset is a subspace of the given vector space. Prove your claim - Is the set P of all polynomials of the form p(x) = a+x2, with a ? R, a subspace of P2?
Construct 4 instances of your instrument : Create a Java test class that simulates using your MusicalInstrument class.  In your test class you should at a minimum construct 4 instances of your instrument,
How could those redundancies lead to anomalies : If you want to produce a listing of the file contents by last name, area code, city, state, or zip code, how would you alter the file structure?
What is the inductive hypothesis : Show that the base case is true and What is the inductive hypothesis P(k)?
How might the tables be related to one another : What tables would you create, and what would the table components be and How might the (independent) tables be related to one another?
Designing the instruction set : For a 3-operand ADD instruction that only uses register addressing mode, how long (number of bits) should the instruction be?

Reviews

Write a Review

JAVA Programming Questions & Answers

  Design a program that extends the definition of the class

Design a program that extends the definition of the class JFrame to display a window on the screen. Name your class PropertyTax1, title your window "Calculation of Property Taxes," set the window's width to 400 pixels and height to 300 pixels, and te..

  Class sorter which contains methods for selection sort

Write a class Sorter which contains methods for selection sort, insertion sort and bubble sort (start with the code below). Then create a client class which asks user to enter ten numbers using arrays. Then the program asks user which sorting algo..

  Write a program to play a variation of the game

Roll two dice. Each die has six faces representing values 1, 1, ..., and 6. Check the sum of the two dice. If the sum is 2, 3, or 12 you lose; if the sum is 7 or 11, you win. If the sum is another value (4,5,6,8,9, or 10) a point is established.

  Write a program to register students for a college students

write a program to register students for a college. students have names addresses and courses. implement the interface

  Develop a gui based java program

Designing and developing a College Registration program

  Objectives1 to practice defining classes using separate

objectives1. to practice defining classes using separate compilation.2. to practice using classes vectors and

  Write a script and verify an logi by reading a file from xl

write a script and verify an logi by reading a file from xl sheet, first time only give the password and get an error message, second time give the email only and get an error message and third time give both email and correct password and get "Signe..

  If the number on two of the players'' four cards

If the number on two of the players' four cards is the same and the number on the remaining two cards is also the same yet the number on all four cards in not the same then the player gets their bet back and in addition wins 22 chips for each chip th..

  Your task in this assignment is to develop a graphical user

your task in this assignment is to develop a graphical user interface based java program that can communicate with a

  Write the code and output result1 real cash register can

write the code and output result.1. real cash register can handle both bills and coins. design a single class that

  Pronouns, and prepositions

Type addKeyword(): for each word on each page, add to a (keyword, URLs) list or dictionary, excluding articles, pronouns, and prepositions. For example:

  Design a class named linearequation

(Algebra: 2 X 2 linear equations) Design a class named LinearEquation for a 2 X 2 system of linear equations.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd