Java Bootcamp – Workbooks and Challenges
)}

Workbook – Part 2

Prerequisite: you finished writing the code for Part 1.

Create a constructor


The Person class has five fields. But, we will ignore the passport field for now.

So, create a Person constructor that receives four parameters. Don't include a parameter for passport.

Call the constructor


Remove the field updates from Part 1. Then, use the constructor to update your fields.

Printing each field results in the following output:

>>: Rayan Slim >>: Canadian >>: 01/01/1111 >>: null >>: 5

Print every field as part of one String.


Use the following template:

System.out.println("Name: " + <name field> + "\n" + "Nationality: " + <nationality field> + "\n" + "Date of Birth: " + <birth date field> + "\n" + "Seat Number: " + <seat number field> + "\n");

>>: Name: Rayan Slim >>: Nationality: Canadian >>: Date of Birth: 01/01/1111 >>: Seat Number: 5

Good Luck!

Feedback Summary
4.8
39 students
5

92%
4

3%
3

0%
2

0%
1

5%
Written Reviews
There are no written reviews yet.