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.3 from VS code.
I need to launch the exact folder that contains my java file.
Task one is to update or create variables based on the provided comments.
So here, by picking up 500 apples from an apple orchard, the number of apples should increase by 500.
So let's do just that.
We'll say number of apples and we can increase the variable on the left by adding to it the value on
the right using the plus equals.
Operator.
All right.
And apparently each apple is going to cost $0.40.
So let's go ahead and create a price variable.
Double price is equal to $0.40.
Now, one customer walked in and he bought four apples.
If each apple costs $0.40, then your profit should increase by four times the price.
So here we'll say profit.
We can increase the profit by adding to it the value on the right, which is going to be four times
whatever the price of each apple is, I believe four times 0.4 is 1.6.
So at this point we have made $1.6.
The number of customers needs to increase by one because one customer walked in.
So a number of customers plus equals one.
And because we sold four apples, that means we have four less apples than what we started with.
So we'll say number of apples minus equals four.
All right.
I'll let you pause the video and try the rest of these on your own.
All right.
Once you do all of that, you can embed each variable into a string.
So I'll do the first one.
I can break the string right over here and concatenate the profit variables as value.
I'll let you pause the video and do the rest.
Looking good.
Finally, we can just run our code Java.
See?
Apple Store Java.
Java Apple Store.
And just like that, after a hard day's work, we made $89.6.
Three customers loved our apples, and in total we have 276 apples left.
We will be selling more tomorrow.
Awesome.