Before we start, did you try solving the workbook yourself?
If not, please click the link in the resources folder and follow the instructions for this workbook.
This video will present the solution to workbook 2.2.
Before we start, please make sure that you launch the exact folder that contains your Java file.
This folder will be called Workbook 2.2 and Task one was to replace each comment over here with a variable.
So name is text, which means you can store that in a string variable name.
So we'll say string name and I will just use a name of SEM.
Age is represented typically as a whole number, as an integer.
So here I'll say int age and we'll say 35.
All right.
Country and sport represent text.
So I'll say string.
Country is equal to England.
And string sport is equal to basketball.
And ours is typically represented as a whole number, as an integer.
So we'll say int ours is equal to two.
Game and subject are also text.
So we'll say string.
Game is equal to checkers.
And string subject is equal to chemistry.
All right.
And grade, assuming that it can only be A, B, c, D, f, we can represent it as a car, as a single
character.
So car grade is equal to B.
Remember that with characters they must be enclosed in single quotes, whereas strings use double,
quote, enclosures.
All right.
And now Task two is to replace each placeholder with a variable.
We did this in the previous lesson.
Not too hard.
First we break the string.
Two plus symbols and then concatenate your variable.
I'll let you pause the video and repeat this for all other variables.
Once you do that, go ahead and compile your code using Java Sea, Java C biography Java and then run
the compiled code.
Oops.
My bad Java biography.
All right.
And just like that, we created a biography using the provided templates.
We effectively merged the variables that we created with the provided template and in turn created our
own personal biography.