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

  Function using javascript syntax to compute gross pay

Write a function using JavaScript syntax to compute a person's gross pay for a week. The function must receive the number of hours worked and the rate of pay per hour.

  String as its parameter and returns the length

Write a method named longestWord that accepts a String as its parameter and returns the length of the longest word in the string.A word is a sequence of one or more non-space characters (any character other than the space character).

  Write a method called printlevel

Write a method called printLevel that takes an integer n as a parameter and that prints the values at level n from left to right. The values should be printed one per line.

  Sorting routine adopted in the java api for arrays.sort()?

What is the sorting routine adopted in the Java API for Arrays.sort()? How different is it from the sorting routine we discussed in class? Is it better? Explain your answers in short clear sentences.

  Simple java program that implements some basic file

Your code will prompt the user to enter a file name. If this file does not exist the program will produce an error message and exit. Otherwise the program will open the file and read a line from the file, reverse the line, and then print the line to ..

  Java program that will add the corresponding elements

Develop a Java program that will add the corresponding elements of two 1-dimensional arrays X and Y to produce the 1-dimensional array Z. Arrays X, Y, Z have the same dimension [M].

  Including four sets of quadruplet andsevwn sets of triplets

Mrs. Bernard Scheinberg of Austria had sixty-nine children. Including four sets of quadruplet, sevwn sets of triplets, and sixten of twins. after Mrs. scheinberg died at the age of 56, her husband remarried. during his remaining years, he fathered an..

  The objective is to implement a menu-based system

The objective is to implement a menu-based system for Bank Accounts in order to simulate a very simple banking system. Many structures have to be declared to manage bank accounts.

  Draw a uml diagram of each of the shapes

Draw a UML diagram of each of the Shapes, Rectangle and Square classes using the code that has been provided. Complete this using the examples that have been provide in the lecture slides.

  Why the java is called platform independent

Why the Java is called platform independent? Discuss.

  Cognitive-based approaches to understanding motivation

Compare and contrast the need-based and cognitive-based approaches to understanding motivation?

  Create a world class that contains a 2d array

You have to create a world class that contains a 2d array then create an abstract class called organism that contains move() method the organism should move randomly one step at the time.

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