subject

In this exercise, you are going to build a hierarchy to create instrument objects. We are going to create part of the orchestra using three classes, Instrument, Wind, and Strings. Note that the Strings class has a name very close to the String class, so be careful with your naming convention! We need to save the following characteristics: Name and family should be saved for all instruments We need to specify whether a strings instrument uses a bow We need to specify whether a wind instrument uses a reed Build the classes out with getters and setters for all classes. Only the superclass needs a toString and the toString should print like this: Violin is a member of the Strings family. Your constructors should be set up to match the objects created in the InstrumentTester class. These are the files given
public class InstrumentTester
{
public static void main(String[] args)
{
/**
* Don't Change This Tester Class!
*
* When you are finished, this should run without error.
*/
Wind tuba = new Wind("Tuba", "Brass", false);
Wind clarinet = new Wind("Clarinet", "Woodwind", true);
Strings violin = new Strings("Violin", true);
Strings harp = new Strings("Harp", false);
System. out. println(tuba);
System. out. println(clarinet);
System. out. println(violin);
System. out. println(harp);
}
}

public class Wind extends Instrument
{
}

public class Strings extends Instrument
{
}

public class Instrument
{
}

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 16:30
If i wanted to include a built-in calendar in a document, what option could i select? draw table insert table insert chart quick tables
Answers: 1
question
Computers and Technology, 23.06.2019 19:00
This question involves a class named textfile that represents a text file. public class textfile { private string filename; private string filename; private arraylist words; // constructors not shown // postcondition: returns the number of bytes in this file public int filesize() { } // precondition: 0 < = index < words.size() // postcondition: removes numwords words from the words arraylist beginning at // index. public void deletewords(int index, int numwords) { } // precondition: 0 < = index < = words.size() // postcondition: adds elements from newwords array to words arraylist beginning // at index. pub lic voidaddwords(int index, string[] newwords) { } // other methods not shown } complete the filesize() method. the filesize() is computed in bytes. in a text file, each character in each word counts as one byte. in addition, there is a space in between each word in the words arraylist, and each of those spaces also counts as one byte. for example, suppose the words arraylist stores the following words: { mary had a little lamb; its fleece was white as snow. } the filesize() method would compute 4 + 3 + 1 + 6 + 5 + 4 + 6 + 3 + 5 + 2 + 5 as the sum of the lengths of each string in the arraylist. the value returned would be this sum plus 10, because there would also be 10 spaces in between the 11 words. complete the filesize() method below: // postcondition: returns the number of bytes in this file public int filesize() { }
Answers: 1
question
Computers and Technology, 24.06.2019 03:30
What is the purpose of a computer network needs assessment? to analyze which workers need more training to improve their performance to compare worker productivity to determine what steps employees can take to increase company revenue to evaluate how to move from the current status to the desired goal
Answers: 2
question
Computers and Technology, 24.06.2019 06:50
What are the things you are considering before uploading photos on social media?
Answers: 1
You know the right answer?
In this exercise, you are going to build a hierarchy to create instrument objects. We are going to c...
Questions
question
Mathematics, 01.09.2019 12:30
question
Mathematics, 01.09.2019 12:30
Questions on the website: 13722361