The document provides instructions for a laboratory exercise on applying encapsulation to a blood bank program. Students are asked to:
1. Create a folder for the exercise and open an existing project.
2. Add a new class, modify the existing code to make attributes private and non-static, and add public getter and setter methods.
3. Move the main method to the new class and use the setter methods to accept user input before displaying values with the getter methods.
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 ratings0% found this document useful (0 votes)
823 views1 page
05 Laboratory Exercise - Blood Bank
The document provides instructions for a laboratory exercise on applying encapsulation to a blood bank program. Students are asked to:
1. Create a folder for the exercise and open an existing project.
2. Add a new class, modify the existing code to make attributes private and non-static, and add public getter and setter methods.
3. Move the main method to the new class and use the setter methods to accept user input before displaying values with the getter methods.
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
IT1908
Laboratory Exercise Blood Bank (Part 2) Objective:
At the end of the activity, the students should be able to:
▪ Apply encapsulation to a program.
Software Requirements:
▪ Latest version of NetBeans IDE
▪ Java Development Kit (JDK) 8
Procedure:
1. Create a folder named LastName_FirstName in your local drive. (ex. Reyes_Mark)
2. Open your LabExer5 project. Add another class named RunBloodData. 3. Modify the program to apply encapsulation. Make bloodType and rhFactor non-static and private. Remove the constructor with two (2) parameters. 4. The names of the public setter and getter methods should be: • setBloodType() • setRhFactor() • getBloodType() • getRhFactor() 5. Move the main method to the RunBloodData class. Edit your code. Use the setter methods to accept user input. 6. Display the values by calling the getter methods.
Sample Output:
GRADING RUBRIC (100 points):
Criterion Description Max Points Correctness The code produces the expected result. 40 Logic The code meets the specifications of the problem. 40 Efficiency The code is concise without sacrificing correctness and logic. 10 Syntax The code adheres to the rules of the programming language. 10