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

  Write an application with three labeled text field

Write an application with three labeled text fields,one each for the initial amount of a savings account, the annual interest rate, and the number of years. Add a button "Calculate" and a read-only text area to display the balance of the savings acco..

  Write a program that asks user how many students to process

Write a program that asks the user how many students to process (must be at least 1, but no more than 20) and then reads in the scores for three items, an exam average score (double number), lab average score (double number) and homework average s..

  The commission employee inherits

The Commission Employee inherits from the Employee class. A Commission Employee contains a commission rate and a sales amount variable which are used as part of the pay calculation. An explicit value constructor should be provided to set all 3 val..

  Correct example of inheritance

Which of the following relationships is not a correct example of inheritance?  Parent to Children  Aunt to Uncle  Grandparent to Grandchild

  Develop a java application

Your task is to develop a Java Application that allows the user to read travel booking data from a text file, save data in a file, display data in a text area, sort data by booking name and search data by booking name.

  What are some debugging techniques for javascript

What are some common programming errors? How can they be prevented? What is the try catch structure, how is it useful? What are some debugging techniques for JavaScript?

  Java script program for song

Construct a JavaScript program that declares and prints an array that includes at least twenty of your favorite songs.

  Determine if strings are equal

Complete the recursive method match in the code below which will determine whether or not two strings match.

  Write a method called negative sum

Write a method called negativeSum that accepts a Scanner reading input from a file containing a series of integers, and print a message to the console indicating whether the sum starting from the first number is ever negative

  Examples of cultural productions from three cultures

Using specific examples of cultural productions from three cultures -Sumerians, Archaic Greeks (800-480 BCE), Classical Greeks (480-323 BCE)- explain how cultural values and ideals are reflected in the creation and style of cultural productions.

  Create a class named student that has three member variables

Create a class named Student that has three member variables

  Develop a graphical user interface based java program

Develop a Java program that can communicate with a real SMTP email server for sending emails. TNE 60003 - introduction to network programming, You program should provide a GUI and can successfully send the SMTP commands to the mail server

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