SlideShare a Scribd company logo
1 of 4
(Object Oriented Programming)
EXERCISE
Creating Classes and Objects
I. Objectives:
At the end of the experiment, students must be able to:
Cognitive
a) understand how object-oriented programming and some of its concepts
b) understand the classes and objects
c) understand how instance variables/methods and class(static) variables/methods are being
used
Psychomotor:
a) construct a program using classes and objects
b) compile and debug the error of the program
Affective
a) appreciate the concept behind this experiment
II. BACKGROUND INFORMATION
A class is a considered as the center of Object Oriented Programming methodology and
defines the abstract characteristics of a thing (object), including the thing's characteristics (its
attributes, fields or properties) and the thing's behaviors (the things it can do, or methods,
operations or features). An object is an instantiation of a class.
In a way, a class and its objects have the relationship of a data type and variables. A class is
simply a template for holding objects. It is abstract but objects are real.
Classes are generally declared using the keyword “class”.
III. EXPERIMENTAL PROCEDURE:
1. A zoo contains a large number of different types of animal. All animals respond to
a message 'talk()' by announcing what they are and their name and age. Each type
of animal is represented by a different sub-class of the animal class.
The zoo itself provides methods to add and subtract animals and responds to the
message 'feedingTime()' by sending the message talk to all the animals.
Animal classes
Create an Animal class and appropriate sub-classes for say Lion, Tiger etc.
Zoo class
Create a Zoo class can contain a number of animals and provides methods to add
and remove animals as well as responding to the method 'feedingTime()'.
Menu class
As this apllication, like so many, will require a menu for the user to drive it, create
a Menu class which has a constructor which enables a set of menu item strings to
be specified and a method which displays the menu and returns the user choice as
an integer. This method should perform some error checking on the user input.
Application class
Create a suitable application class with a main method which provides a menu for
user interaction and interacts with a zoo object.
2. Write a grading program for each class with the following grading policies:
a. There are two quizzes, each graded on the basis of 10 points.
b. There is one midterm exam and one final exam, each graded on the basis of 100
points.
c. The final exam counts for 50% of the grade, the midterm counts for 25%, and
the two quizzes together count for a total of 25%.(Do not forget to normalize the
quiz scores. They should be converted to a percent before they are average in.) Any
grade of 90 or more is an A, any grade of 80 or more (but less than 90 is B, any
grade of 70 or more (but less than 80) is a C, any grade of 60 or more (but less than
70) is a D, and any grade below 60 is an F. The program will read in the student’s
scores and output the student’s record, which consists of two quiz and two exam
scores as well as the student’s overall numeric score for the entire course and final
letter grade. Define and use a class for the student record. The class should have
instance variables for the quizzes, midterm, final, course overall numeric score, and
course final letter grade. The overall numeric score is a number in the range 0 to
100, which represents the weighted average of the student’s work. The class should
have input and output methods. The input method should not ask for the final
numeric grade nor should it ask for the final letter grade. The class should have
methods to compute the overall numeric grade and the final letter grade. These last
two methods will be void methods that set the appropriate instance variables.
Remember, one method can call another method. If you prefer, you can define a
single method that sets both the overall numeric score and the
final letter grade, but if you do this, use a helping method. Your program should
use all the methods we discussed. Your class should have a reasonable set of
accessor and mutator methods, whether or not your program uses them. You may
add other methods if you wish.
3. Create a class that graphs the grade distribution (number of A’s, B’s, C’s, D’s, and
F’s) horizontally by printing lines with proportionate numbers of asterisks
corresponding to the percentage of grades in each category. Write methods to set the
number of each letter grade; red the number of each letter grade, return the total
number of grades, return the percent of each letter grade as a whole number between 0
and 100, inclusive; and draw the graph. Set it up so that 50 asterisks correspond to
100% (each one corresponds 2%), include a scale on the horizontal axis indicating
each 10% increment from 0 to 100%, and label each line with its letter grade. For
example, if there are 1 A’s, 4 B’s, 6 C’s, 2 D’s and 1 F, the total number of grades is
14, the percentage of A’s is 7, percentage of B’s is 29, percentage of C’s is 43,
percentage of D’s is 14, and percentage of F’s is 7. The A row would contain 4
asterisks (7% of 50 rounded to the nearest the B row 14, the C row 21, the D row 7,
and the F row 4, so the graph would look like this
0 10 20 30 40 50 60 70 80 90 100
***************************************************
**** A
************** B
********************* C
******* D
**** F
V. QUESTION AND ANSWER:
1. What is the difference between classes and objects?
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
__
2. Consider the following class:
public class IdentifyMyParts {
public static int x = 7;
public int y = 3;
}
1. What are the class variables?
2. What are the instance variables?
_____________________________________________________________________________
_____________________________________________________________________________
_____________________________________________________________________________
__

More Related Content

Viewers also liked

Lab exam setb_5_5_2015
Lab exam setb_5_5_2015Lab exam setb_5_5_2015
Lab exam setb_5_5_2015Daman Toor
 
Lab exp (declaring classes)
Lab exp (declaring classes)Lab exp (declaring classes)
Lab exp (declaring classes)Daman Toor
 
Parking ticket simulator program
Parking ticket simulator programParking ticket simulator program
Parking ticket simulator programDaman Toor
 
Lab exp declaring arrays)
Lab exp declaring arrays)Lab exp declaring arrays)
Lab exp declaring arrays)Daman Toor
 
Lab exam 5_5_15
Lab exam 5_5_15Lab exam 5_5_15
Lab exam 5_5_15Daman Toor
 
Java assignment 1
Java assignment 1Java assignment 1
Java assignment 1Daman Toor
 

Viewers also liked (8)

Practice
PracticePractice
Practice
 
Lab exam setb_5_5_2015
Lab exam setb_5_5_2015Lab exam setb_5_5_2015
Lab exam setb_5_5_2015
 
Lab exp (declaring classes)
Lab exp (declaring classes)Lab exp (declaring classes)
Lab exp (declaring classes)
 
Parking ticket simulator program
Parking ticket simulator programParking ticket simulator program
Parking ticket simulator program
 
Lab exp declaring arrays)
Lab exp declaring arrays)Lab exp declaring arrays)
Lab exp declaring arrays)
 
Lab exam 5_5_15
Lab exam 5_5_15Lab exam 5_5_15
Lab exam 5_5_15
 
Uta005
Uta005Uta005
Uta005
 
Java assignment 1
Java assignment 1Java assignment 1
Java assignment 1
 

Similar to Lab exp (creating classes and objects)

ISM3230 In-class lab 8 Spring 2019 TOPIC Introduction .docx
ISM3230 In-class lab 8 Spring 2019 TOPIC  Introduction .docxISM3230 In-class lab 8 Spring 2019 TOPIC  Introduction .docx
ISM3230 In-class lab 8 Spring 2019 TOPIC Introduction .docxvrickens
 
Write a grading program for a class with the following gradingpolicies: 1....
Write a grading program for a class with the following gradingpolicies:    1....Write a grading program for a class with the following gradingpolicies:    1....
Write a grading program for a class with the following gradingpolicies: 1....hwbloom6
 
Op siena system consensus map 2019 7
Op siena system consensus map 2019 7Op siena system consensus map 2019 7
Op siena system consensus map 2019 7RedenOriola
 
DIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docx
DIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docxDIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docx
DIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docxlynettearnold46882
 
New York Survey DataInstructionsA consulting firm was hired to.docx
New York Survey DataInstructionsA consulting firm was hired to.docxNew York Survey DataInstructionsA consulting firm was hired to.docx
New York Survey DataInstructionsA consulting firm was hired to.docxcurwenmichaela
 
B.ed. 4th sem computational literacy
B.ed. 4th sem computational literacyB.ed. 4th sem computational literacy
B.ed. 4th sem computational literacyDammar Singh Saud
 
B.ed. 4th sem computational literacy
B.ed. 4th sem computational literacyB.ed. 4th sem computational literacy
B.ed. 4th sem computational literacyDammar Singh Saud
 
LESSON-8-ANALYSIS-INTERPRETATION-AND-USE-OF-TEST-DATA.pptx
LESSON-8-ANALYSIS-INTERPRETATION-AND-USE-OF-TEST-DATA.pptxLESSON-8-ANALYSIS-INTERPRETATION-AND-USE-OF-TEST-DATA.pptx
LESSON-8-ANALYSIS-INTERPRETATION-AND-USE-OF-TEST-DATA.pptxMarjoriAnneDelosReye
 
Mat120 syllabus
Mat120 syllabusMat120 syllabus
Mat120 syllabuschellc14
 
Educational Psychology 565 Practice Quiz(use α = .05 unl.docx
Educational Psychology 565 Practice Quiz(use α = .05 unl.docxEducational Psychology 565 Practice Quiz(use α = .05 unl.docx
Educational Psychology 565 Practice Quiz(use α = .05 unl.docxtoltonkendal
 
Page 2 of 5 MG 620 Term Project and Grading RubricsSPRING 2.docx
Page 2 of 5 MG 620 Term Project and Grading RubricsSPRING 2.docxPage 2 of 5 MG 620 Term Project and Grading RubricsSPRING 2.docx
Page 2 of 5 MG 620 Term Project and Grading RubricsSPRING 2.docxkarlhennesey
 
Cot in Mathematics Q3 Week1.pptx
Cot in Mathematics Q3 Week1.pptxCot in Mathematics Q3 Week1.pptx
Cot in Mathematics Q3 Week1.pptxMarjorieAnn4
 
Assessment of Learning 2
Assessment of Learning 2Assessment of Learning 2
Assessment of Learning 2Aira Bustamante
 
Mb0040 statistics for management
Mb0040 statistics for managementMb0040 statistics for management
Mb0040 statistics for managementsmumbahelp
 

Similar to Lab exp (creating classes and objects) (20)

ISM3230 In-class lab 8 Spring 2019 TOPIC Introduction .docx
ISM3230 In-class lab 8 Spring 2019 TOPIC  Introduction .docxISM3230 In-class lab 8 Spring 2019 TOPIC  Introduction .docx
ISM3230 In-class lab 8 Spring 2019 TOPIC Introduction .docx
 
Hw5
Hw5Hw5
Hw5
 
Write a grading program for a class with the following gradingpolicies: 1....
Write a grading program for a class with the following gradingpolicies:    1....Write a grading program for a class with the following gradingpolicies:    1....
Write a grading program for a class with the following gradingpolicies: 1....
 
Op siena system consensus map 2019 7
Op siena system consensus map 2019 7Op siena system consensus map 2019 7
Op siena system consensus map 2019 7
 
DIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docx
DIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docxDIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docx
DIRECTIONS READ THE FOLLOWING STUDENT POST AND RESPOND EVALUATE I.docx
 
Csrde discriminant analysis final
Csrde discriminant analysis finalCsrde discriminant analysis final
Csrde discriminant analysis final
 
New York Survey DataInstructionsA consulting firm was hired to.docx
New York Survey DataInstructionsA consulting firm was hired to.docxNew York Survey DataInstructionsA consulting firm was hired to.docx
New York Survey DataInstructionsA consulting firm was hired to.docx
 
Advanced Statistics.pptx
Advanced Statistics.pptxAdvanced Statistics.pptx
Advanced Statistics.pptx
 
B.ed. 4th sem computational literacy
B.ed. 4th sem computational literacyB.ed. 4th sem computational literacy
B.ed. 4th sem computational literacy
 
B.ed. 4th sem computational literacy
B.ed. 4th sem computational literacyB.ed. 4th sem computational literacy
B.ed. 4th sem computational literacy
 
Grading sh-learners
Grading sh-learnersGrading sh-learners
Grading sh-learners
 
Grading sh-learners
Grading sh-learnersGrading sh-learners
Grading sh-learners
 
LESSON-8-ANALYSIS-INTERPRETATION-AND-USE-OF-TEST-DATA.pptx
LESSON-8-ANALYSIS-INTERPRETATION-AND-USE-OF-TEST-DATA.pptxLESSON-8-ANALYSIS-INTERPRETATION-AND-USE-OF-TEST-DATA.pptx
LESSON-8-ANALYSIS-INTERPRETATION-AND-USE-OF-TEST-DATA.pptx
 
Mat120 syllabus
Mat120 syllabusMat120 syllabus
Mat120 syllabus
 
Skelton.MISL2015
Skelton.MISL2015Skelton.MISL2015
Skelton.MISL2015
 
Educational Psychology 565 Practice Quiz(use α = .05 unl.docx
Educational Psychology 565 Practice Quiz(use α = .05 unl.docxEducational Psychology 565 Practice Quiz(use α = .05 unl.docx
Educational Psychology 565 Practice Quiz(use α = .05 unl.docx
 
Page 2 of 5 MG 620 Term Project and Grading RubricsSPRING 2.docx
Page 2 of 5 MG 620 Term Project and Grading RubricsSPRING 2.docxPage 2 of 5 MG 620 Term Project and Grading RubricsSPRING 2.docx
Page 2 of 5 MG 620 Term Project and Grading RubricsSPRING 2.docx
 
Cot in Mathematics Q3 Week1.pptx
Cot in Mathematics Q3 Week1.pptxCot in Mathematics Q3 Week1.pptx
Cot in Mathematics Q3 Week1.pptx
 
Assessment of Learning 2
Assessment of Learning 2Assessment of Learning 2
Assessment of Learning 2
 
Mb0040 statistics for management
Mb0040 statistics for managementMb0040 statistics for management
Mb0040 statistics for management
 

More from Daman Toor

Identifiers, keywords and types
Identifiers, keywords and typesIdentifiers, keywords and types
Identifiers, keywords and typesDaman Toor
 
Classes & object
Classes & objectClasses & object
Classes & objectDaman Toor
 

More from Daman Toor (7)

String slide
String slideString slide
String slide
 
Nested class
Nested classNested class
Nested class
 
Inheritance1
Inheritance1Inheritance1
Inheritance1
 
Inheritance
InheritanceInheritance
Inheritance
 
Operators
OperatorsOperators
Operators
 
Identifiers, keywords and types
Identifiers, keywords and typesIdentifiers, keywords and types
Identifiers, keywords and types
 
Classes & object
Classes & objectClasses & object
Classes & object
 

Recently uploaded

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 

Recently uploaded (20)

How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 

Lab exp (creating classes and objects)

  • 1. (Object Oriented Programming) EXERCISE Creating Classes and Objects I. Objectives: At the end of the experiment, students must be able to: Cognitive a) understand how object-oriented programming and some of its concepts b) understand the classes and objects c) understand how instance variables/methods and class(static) variables/methods are being used Psychomotor: a) construct a program using classes and objects b) compile and debug the error of the program
  • 2. Affective a) appreciate the concept behind this experiment II. BACKGROUND INFORMATION A class is a considered as the center of Object Oriented Programming methodology and defines the abstract characteristics of a thing (object), including the thing's characteristics (its attributes, fields or properties) and the thing's behaviors (the things it can do, or methods, operations or features). An object is an instantiation of a class. In a way, a class and its objects have the relationship of a data type and variables. A class is simply a template for holding objects. It is abstract but objects are real. Classes are generally declared using the keyword “class”. III. EXPERIMENTAL PROCEDURE: 1. A zoo contains a large number of different types of animal. All animals respond to a message 'talk()' by announcing what they are and their name and age. Each type of animal is represented by a different sub-class of the animal class. The zoo itself provides methods to add and subtract animals and responds to the message 'feedingTime()' by sending the message talk to all the animals. Animal classes Create an Animal class and appropriate sub-classes for say Lion, Tiger etc. Zoo class Create a Zoo class can contain a number of animals and provides methods to add and remove animals as well as responding to the method 'feedingTime()'. Menu class As this apllication, like so many, will require a menu for the user to drive it, create a Menu class which has a constructor which enables a set of menu item strings to be specified and a method which displays the menu and returns the user choice as an integer. This method should perform some error checking on the user input. Application class Create a suitable application class with a main method which provides a menu for user interaction and interacts with a zoo object. 2. Write a grading program for each class with the following grading policies: a. There are two quizzes, each graded on the basis of 10 points. b. There is one midterm exam and one final exam, each graded on the basis of 100 points. c. The final exam counts for 50% of the grade, the midterm counts for 25%, and the two quizzes together count for a total of 25%.(Do not forget to normalize the quiz scores. They should be converted to a percent before they are average in.) Any grade of 90 or more is an A, any grade of 80 or more (but less than 90 is B, any grade of 70 or more (but less than 80) is a C, any grade of 60 or more (but less than 70) is a D, and any grade below 60 is an F. The program will read in the student’s scores and output the student’s record, which consists of two quiz and two exam scores as well as the student’s overall numeric score for the entire course and final letter grade. Define and use a class for the student record. The class should have instance variables for the quizzes, midterm, final, course overall numeric score, and course final letter grade. The overall numeric score is a number in the range 0 to 100, which represents the weighted average of the student’s work. The class should have input and output methods. The input method should not ask for the final numeric grade nor should it ask for the final letter grade. The class should have methods to compute the overall numeric grade and the final letter grade. These last two methods will be void methods that set the appropriate instance variables. Remember, one method can call another method. If you prefer, you can define a single method that sets both the overall numeric score and the final letter grade, but if you do this, use a helping method. Your program should use all the methods we discussed. Your class should have a reasonable set of accessor and mutator methods, whether or not your program uses them. You may add other methods if you wish.
  • 3. 3. Create a class that graphs the grade distribution (number of A’s, B’s, C’s, D’s, and F’s) horizontally by printing lines with proportionate numbers of asterisks corresponding to the percentage of grades in each category. Write methods to set the number of each letter grade; red the number of each letter grade, return the total number of grades, return the percent of each letter grade as a whole number between 0 and 100, inclusive; and draw the graph. Set it up so that 50 asterisks correspond to 100% (each one corresponds 2%), include a scale on the horizontal axis indicating each 10% increment from 0 to 100%, and label each line with its letter grade. For example, if there are 1 A’s, 4 B’s, 6 C’s, 2 D’s and 1 F, the total number of grades is 14, the percentage of A’s is 7, percentage of B’s is 29, percentage of C’s is 43, percentage of D’s is 14, and percentage of F’s is 7. The A row would contain 4 asterisks (7% of 50 rounded to the nearest the B row 14, the C row 21, the D row 7, and the F row 4, so the graph would look like this 0 10 20 30 40 50 60 70 80 90 100 *************************************************** **** A ************** B ********************* C ******* D **** F
  • 4. V. QUESTION AND ANSWER: 1. What is the difference between classes and objects? _____________________________________________________________________________ _____________________________________________________________________________ _____________________________________________________________________________ __ 2. Consider the following class: public class IdentifyMyParts { public static int x = 7; public int y = 3; } 1. What are the class variables? 2. What are the instance variables? _____________________________________________________________________________ _____________________________________________________________________________ _____________________________________________________________________________ __