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

1- describe what class used for? 2- describe encapsulation as it relates to obje

ID: 3725115 • Letter: 1

Question

1- describe what class used for? 2- describe encapsulation as it relates to objects oriented programning? I want to answer these question !!! I do not want the coding just answer the two question,!!! Lab 12 Apple Maker Objective: Write a progam that creates a class Apple and a tester to make sure the Apple class is crisp and delicious First create a cless called Apple . Write a class file called Apple that DOES NOT HAVE a main method Some ofthe attributes of Apple are Type: A string that descries the apple.. It may only be ofthese following types . Golden Delicious . Gala Granny Smith Weight A decimal valoe representing the apple's weight in kilograms. The weight must be bertween Okg and 2kg o Price: The price per apple. This must be a non-negative decimal value Create the to default values and has no parameters Default-sets o MAKE SURE THE MUTATORS CHECK FOR VALID VALUESt toString: Returns a string with all of the instance variable values equal Accessors and Mutators for each variable · Create the following Methods Ex: "Name: > Weight " a Boolean andt kes in another instance of an apple s tre if all of the instance vanables equal te instance variables in the other app This method r ltretu Finally create a cless called AppleTester This class DOES HAVE a main method Create at least 3 different types ofapples Test if the accessors, mutators, and other methods work as intended Example Dialog: Welcome to the apple tester Creating a default apple Printing the default apple's values Name: Gala Weight: 0.5 Price: 0.89 Creating another apple setting the new apple's values to the following valid values "Granny Smith" 0.15 0.99

Explanation / Answer

Answer is as follows:

a) Class in java :

A class is a blueprint from which individual objects are created.

A class is define as the entity under which all the attributes or properties and functions are declared and used to perform some operations.

There is a main class in Java that is used to call main method and also used to declared objects of other described classes.

Classes in Java desccribes the behaviour of any object i.e. what operation the object can perfomed.

b) Encapsulation :

Encapsulation is main and most important part of Object Oriented in Programming Language.

It is the mechanisms of wrapping or grouping of the data i.e. variables and action of data i.e. methods into a single unit.

In encapsulation, the variables of a class will be hidden from other classes, and can be accessed only through the methods of their current class. Therefore, it is also known as data hiding.

For achive the encapsulation in Java the rules are :

if there is any query please ask in comments......