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, 21.06.2019 21:30
Write code using c . (take input from user) calculate the size of a given file in kbs. in this task you will complete the function with the following prototype: float get_file_size(char * filename); the function takes the file name (address to the start of a null terminated character array) as input. the function should then open the file and find the number of bytes it contains till eof. the number of bytes divided by 1024 will give the size in kbs. if the file cannot be opened the function should return -1.
Answers: 2
question
Computers and Technology, 22.06.2019 16:30
Which of the following statements best describes it careers?
Answers: 2
question
Computers and Technology, 22.06.2019 19:20
1)consider the following code snippet: #ifndef book_h#define book_hconst double max_cost = 1000.0; class book{public: book(); book(double new_cost); void set_cost(double new_cost); double get_cost() const; private: double cost; }; double calculate_terms(book bk); #endifwhich of the following is correct? a)the header file is correct as given.b)the definition of max_cost should be removed since header files should not contain constants.c)the definition of book should be removed since header files should not contain class definitions.d)the body of the calculate_terms function should be added to the header file.
Answers: 1
question
Computers and Technology, 23.06.2019 08:30
When you interpret the behavior of others according to your experiences and understanding of the world your evaluation is
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
Chemistry, 07.09.2021 06:00
question
Mathematics, 07.09.2021 06:00
question
English, 07.09.2021 06:00
question
Chemistry, 07.09.2021 06:00
Questions on the website: 13722362