Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please use the following terms to describe the use cases below - Encapsulation,

ID: 3600085 • Letter: P

Question

Please use the following terms to describe the use cases below - Encapsulation, Inheritance, Polymorphism, Overriding, Overloading, Implementation. (There may be more than one instance of the terms) An interface Spinnable has one function spin). A Wheel and a Disk both provide the Spinnable interfac [ Choose ] The Integer class support two versions of parselnt)- one that takes only a String, the other that takes a String and an integer (for base) Choose RuntimeException is a special case of Exception that occurs only at runtime. [ Choose ] A method called drive) expects a Vehicle but is given a Car instead, because a Car is a Vehicle Choose ] The analyst asks for the method calculateProfit to be hidden because he does not want to expose business rules Choose] A Thermometer class has methods to accept both Centigrade and Fahrenheit as inputs but internally uses on Centigrade for all its calculations. Choose JOptionPane's showMessageDialoguses multiple versions to support custom calls Choose] he way area is calculated using getArea0[Choose method is different for Circle, Square and Triangle, although all of them are Shapes. A BoardGame and Violin are both Playable objects and therefore implement a play method Choose An Array object knows how to resize itself as needed [ Choose ]

Explanation / Answer

1. Both the classes implement the same interface Spinnable. So it is implementation of Inheritance.

2. Integer class shows the two versions of parseInt(). It is the working of overloading or we can say method overloading.

3. Runtime exception is a part of Exception class. So it is simple Inheritance. Here exception is a super class of runtime exception.

4. drive method will given to class Car, so it is inheritance which have the method drive which belong to vehicle class but implemented in class Car. Vehical class is base class, whether Car is derived class.

5. It is encapsulation which wrap the data with the method, so no manipulations will take place.

6. Polymorphism and Encapsulation works here. Wrapping of data and one instance show different behaviour i.e temperature.

7. showMessageDialog is overriding. Overriding means providing different definition to any method.

8. getArea method shows different behaviour for different shapes. So it is the example of overriding and Polymorphism.

9. It is implementation. Here both implementing the same method which will come from an interface.

10. It is overrinding. Changing the working as per needed.