CSE 331 Assignment Midterm
CSE 331 Assignment Midterm
b) Can an interface itself be treated as a data type, and if so, how does this affect the
design and use of interfaces in your program? What happens if two unrelated
interfaces are implemented in one class but have the same method signature?
2. a) Explain the concept of method overloading where you will try to print the area
of various polygons such as circle and rectangle. Here the method area() must
be overloaded with different numbers of parameters. The output should look
like this.
b) What happens if class Z does not provide its own implementation of the show() method?
interface A {
void display();
}
interface B {
void display();
}
c) You are tasked with managing a collection of different musical instruments in a digital band
simulator. Each instrument should have the ability to perform its unique sound when played. There
are several types of instruments, including string, percussion, and wind instruments. In this
scenario, you need to design a system that allows these instruments to perform in sequence.
• The challenge is to manage these different instruments in a uniform way, ensuring that
each performs correctly when instructed, without needing to know the specific type of
instrument beforehand.