0% found this document useful (0 votes)
169 views5 pages

Lab Exp 5 FD-Classes-1

The document provides instructions for an experiment on creating classes and objects in Java, including creating a Student class with attributes like name, ID, and grade, as well as custom methods. Students are asked to create class diagrams and sample outputs to demonstrate their understanding of object-oriented programming concepts like classes, objects, and methods. Evaluation criteria are provided to assess students' work.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
169 views5 pages

Lab Exp 5 FD-Classes-1

The document provides instructions for an experiment on creating classes and objects in Java, including creating a Student class with attributes like name, ID, and grade, as well as custom methods. Students are asked to create class diagrams and sample outputs to demonstrate their understanding of object-oriented programming concepts like classes, objects, and methods. Evaluation criteria are provided to assess students' work.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

DEPARTMENT OF COMPUTER STUDIES

CCS0023L
(Object Oriented Programming)

EXERCISE

5
Creating Classes and Objects

Kemuel Shiphtan B. Albiento


BSIT – W21
October 13, 2019
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: Create the Class Diagram of the following program
description using JDeveloper/NetBeans.

A. Make a class named Students which will contain the following fields:
Student Name (String), Student ID (Integer), and Midterm Grade (Double) with the
following default values: John Smith, 12345678, 70.00 respectively (3)
1. Create a constructor that will accept values for all 3 fields respectively and
assign the values to the class variables
2. Create the standard methods for the Students class (Setters and Getters)
3. Create a custom method for the Students class called display_information which
simply displays the following:
Welcome (Name of student)!
Your Student ID is: (Student ID)

Your current Midterm GPA for this class is: (Midterm Grade)

4. Create a custom method for the Students class called compute_requiredFG


which will display the required Final Grade for the student to get a GPA of 70. This
will be considered as the minimum Final Grade for the student to pass the class

The computation for the GPA is 40% of midterm grade + 60% of the final grade

Requirements:
1. Submit your codes in a single file (txt or java is accepted). Do not zip the files
if you have more than 1 file to upload.
2. Screenshot at least 3 sample outputs and paste it in this document.
3. Copy and paste your source codes at the end of this document after the output
screenshots. Do not forget to label everything.
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?

A class is a blueprint from which you can create the instance, i.e., objects. While An object is the
instance of the class, which helps programmers to use variables and methods from inside the class.

2. Consider the following class:


public class IdentifyMyParts {
public static int x = 7;
public int y = 3;
}

1. What are the class variables?


The value of the class variable IdentifyMyParts

2. What are the instance variables?


The value of the instance variable int x = 7 and int y = 3
Topic Introduction to Object-Oriented
Programming
Lab Activity No 5a
Lab Activity Zoo Animals
CLO 2
Program execution (20)
Correct output (20)
Design of output (10)
Design of logic (20)
Standards (20)
Delivery (10)
TOTAL

Topic Introduction to Object-Oriented


Programming
Lab Activity No 5b
Lab Activity Grading System
CLO 2
Program execution (20)
Correct output (20)
Design of output (10)
Design of logic (20)
Standards (20)
Delivery (10)
TOTAL

Topic Introduction to Object-Oriented


Programming
Lab Activity No 5c
Lab Activity Grade Distribution
CLO 2
Program execution (20)
Correct output (20)
Design of output (10)
Design of logic (20)
Standards (20)
Delivery (10)
TOTAL

You might also like