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

1. (TCO 8) Briefly describe best practices as it relates to naming classes. (Poi

ID: 3851649 • Letter: 1

Question

1. (TCO 8) Briefly describe best practices as it relates to naming classes. (Points : 18)       
      

Question 2. 2. (TCO 2) Sometimes the terms Encapsulation and Data/Information Hiding in object-oriented programming are used interchangeably. Can you give an example, which shows that they are actually different? (Points : 18)

Question 3. 3. (TCO 2) Given the following list of classes, attributes and methods,

·         identify which items are classes, which items are attributes and which items are methods;
·         identify which class each attribute and method belongs to; and
·         suggest a class hierarchy given your list of classes.

*Note - no particular capitalization scheme is used in the list below to differentiate between classes, methods, and attributes.

Brew, DecreaseTemperature, Manufacturer, MinCups, Price, TurnOff, Oven, MaxTemperature, BrewStrength, NumberOfRacks, IncreaseTemperature, TurnOn, StartTimer, CoffeeMaker, KitchenAppliance, MaxCups, YearBuilt, Grind (Points : 18)

Question 2. 2. (TCO 2) Sometimes the terms Encapsulation and Data/Information Hiding in object-oriented programming are used interchangeably. Can you give an example, which shows that they are actually different? (Points : 18)

      
      

Explanation / Answer

Yes.Sometimes they are.but it doesn't mean that they are same thing.Consider JDK and JRE.They are two diffrent things and people use the two terms interchangebly.

Encapsulation: It is nothing but combining or grouping of related idead in to single unit , thereafter be referred by a single name.

From subroutine level to object level encapsulation in the object oriented level will expands on this concept.They all are packaged in to an object type i.e the the attributes which represents the state of an object and methods that work on them.

Information hiding:

it is nothing but the process of hiding the details of an function or object.It is very powerful because it reduces complexity.Here encapsulation is the chief mechanism.

Through this information hiding feauther it is used to help for programmers from intentionally or unintentionally changing parts of the program

I will explain small example here

public class Arrow
{
   public double x;
   public double y;
}

Here the above program is merely encapsulated.


public interface Arrow
{
    double GetX();
    double GetY();
    void SetCartesian(double x, double y);
    double GetR();
    double GetTheta();
    void SetPolar(double r, double theta);
}

Here observe the above example.The actual part of implementation is completely hidden.the client doesnt know that whether internal representation of the point is in polar coordinates or in rectangular.