Workbook 7.3
From the Java Bootcamp Resources
, launch Workbook 7.3
.
Task 1
Make each field private
.
private String name; private String nationality; private String dateOfBirth; private String[] passport; private int seatNumber;
Task 2
Add getters for name
, nationality
, dateOfBirth
, and seatNumber
.
Task 3
Call the getters from your println
function and re-run the code.
>>: Name: Rayan Slim
>>: Nationality: Canadian
>>: Date of Birth: 01/01/1111
>>: Seat Number: 5
Task 4
Add setters for name
, nationality
, dateOfBirth
, and seatNumber
.
Task 5
The person's current seat number is already taken. Update their seat number to 10 before printing the fields.
>>: Name: Rayan Slim
>>: Nationality: Canadian
>>: Date of Birth: 01/01/1111
>>: Seat Number: 10
Visualizing the Runtime
After you solve this workbook, I still recommend watching the video solution on Udemy.
It will show you how to visualize the runtime using Visual Studio Code.
Associated Course: The Complete Java Development Bootcamp
Related Course: The Complete Spring Boot Development Bootcamp – Become a Java Web Developer
Feedback Summary
4.7
43 students
5
91%
4
2%
3
0%
2
0%
1
7%
Written Reviews
There are no written reviews yet.