A Barbershop Quartet is a group of four singers: a lead, a tenor, a bass, and a baritone. These four singers harmonize to produce a purely American form of music developed in the 19th century. Consider the incomplete class definitions below. public class BarberShopQuartet { public BarberShopQuartet() { Tenor highSinger = new Tenor(); Baritone bari = new Baritone(); Lead melody = new Lead(); Bass lowSinger = new Bass(); System.out.println(“Quartet created.”); } } ______________________________________________________________________________ public class Singer { public Singer() { System.out.println(“Singing...”); } } ______________________________________________________________________________ public class Tenor extends Singer { public Tenor() { System.out.println(“Singing...the high notes”); } } ______________________________________________________________________________ public class Baritone extends Singer { public Baritone() { System.out.println(“Singing...harmonizing with the lead”); } } ______________________________________________________________________________ public class Lead extends Singer { public Lead() { System.out.println(“Singing...the melody and providing the emotion”); } } ______________________________________________________________________________ public class Bass extends Singer { public Bass() { System.out.println(“Singing...the very low notes”); } } Which of the following IS-A, HAS-A relationships is true? A. A Baritone has-a BarberShopQuartet. B. A Singer has-a Lead. C. A BarberShopQuartet is-a Singer. D. A Singer has-a BarberShopQuartet. E. A Tenor is-a Singer.
OOPs
In today's technology-driven world, computer programming skills are in high demand. The object-oriented programming (OOP) approach is very much useful while designing and maintaining software programs. Object-oriented programming (OOP) is a basic programming paradigm that almost every developer has used at some stage in their career.
Constructor
The easiest way to think of a constructor in object-oriented programming (OOP) languages is:
A Barbershop Quartet is a group of four singers: a lead, a tenor, a bass, and a baritone. These four singers harmonize to produce a purely American form of music developed in the 19th century. Consider the incomplete class definitions below.
public class BarberShopQuartet
{
public BarberShopQuartet()
{
Tenor highSinger = new Tenor();
Baritone bari = new Baritone();
Lead melody = new Lead();
Bass lowSinger = new Bass();
System.out.println(“Quartet created.”);
}
}
______________________________________________________________________________
public class Singer
{
public Singer()
{
System.out.println(“Singing...”);
}
}
______________________________________________________________________________
public class Tenor extends Singer
{
public Tenor()
{
System.out.println(“Singing...the high notes”);
}
}
______________________________________________________________________________
public class Baritone extends Singer
{
public Baritone()
{
System.out.println(“Singing...harmonizing with the lead”);
}
}
______________________________________________________________________________
public class Lead extends Singer
{
public Lead()
{
System.out.println(“Singing...the melody and providing the
emotion”);
}
}
______________________________________________________________________________
public class Bass extends Singer
{
public Bass()
{
System.out.println(“Singing...the very low notes”);
}
}
Which of the following IS-A, HAS-A relationships is true?
A. |
A Baritone has-a BarberShopQuartet. |
|
B. |
A Singer has-a Lead. |
|
C. |
A BarberShopQuartet is-a Singer. |
|
D. |
A Singer has-a BarberShopQuartet.
|
|
E. |
A Tenor is-a Singer. |
Trending now
This is a popular solution!
Step by step
Solved in 3 steps