0% found this document useful (0 votes)
235 views1 page

05 Laboratory Exercise 1

The document outlines a laboratory exercise for students to learn about enumerated types and nested classes in Java. It provides a step-by-step procedure to create four Java classes, implement enumerations for colors and models, and instantiate Car objects. A grading rubric is included to evaluate the completeness and coding quality of the exercise.

Uploaded by

scprivt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
235 views1 page

05 Laboratory Exercise 1

The document outlines a laboratory exercise for students to learn about enumerated types and nested classes in Java. It provides a step-by-step procedure to create four Java classes, implement enumerations for colors and models, and instantiate Car objects. A grading rubric is included to evaluate the completeness and coding quality of the exercise.

Uploaded by

scprivt
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

IT2408

Laboratory Exercise
Enumerations and Nested Classes
Objective:

At the end of the exercise, the students should be able to:

▪ Use enumerated types and nested classes in programs

Requirements:

▪ Microsoft Word
▪ NetBeans

Procedure (60 points):


1. Create four (4) Java classes named Color, Model, Car, and CarDemo.
2. In the Color class, create an enum named Color that consists of six (6) colors of your choice.
3. In the Model class, create an enum named Model that contains the following values: SEDAN, SUV,
CONVERTIBLE, and HATCHBACK.
4. In the Car class, declare three (3) private fields:
o int variable named year
o A Model object named model
o A Color model named color
5. Add a constructor for the Car class with three (3) parameters: yr (int), model (Model), and color
(Color). Inside the constructor, assign yr to year, m to model, and c to color.
6. Add a display( ) method that prints the three (3) Car object's data.
7. In the main method of the CarDemo class, instantiate two (2) Car objects, assigning values to them
using enumeration values for the models and colors. Example: Car car1 = new Car(2014,
Model.SUV, Color.RED);
8. Add two (2) statements to display the data of the two (2) Car objects.
9. Compile the code in a Word file.
10. Call the instructor to check your outputs before submitting a PDF copy on eLMS.

GRADING RUBRIC
Needs
Excellent Good Poor
Criteria Improvement Points
4 3 1
2
The student did The student The student missed The student
Completeness
all the missed one (1) half of the missed all of the __/20
(x5) requirements. requirement. requirements. requirements.
The code is The code is The code is
The code is properly
Coding complete and complete but incomplete and
properly improperly
structured but
improperly
__/40
(x10) incomplete.
structured. structured. structured.
Total Score __/60

05 Laboratory Exercise 1 *Property of STI


Page 1 of 1

You might also like