1 00:00:00,150 --> 00:00:03,840 Before we start, did you try solving the workbook yourself? 2 00:00:03,870 --> 00:00:09,630 If not, please click the link in the resources folder and follow the instructions for this workbook. 3 00:00:10,800 --> 00:00:15,150 This video will present the solution to workbook 2.3 from VS code. 4 00:00:15,150 --> 00:00:18,630 I need to launch the exact folder that contains my java file. 5 00:00:18,660 --> 00:00:24,240 Task one is to update or create variables based on the provided comments. 6 00:00:24,240 --> 00:00:32,580 So here, by picking up 500 apples from an apple orchard, the number of apples should increase by 500. 7 00:00:32,580 --> 00:00:34,200 So let's do just that. 8 00:00:34,500 --> 00:00:41,130 We'll say number of apples and we can increase the variable on the left by adding to it the value on 9 00:00:41,130 --> 00:00:42,840 the right using the plus equals. 10 00:00:42,840 --> 00:00:43,620 Operator. 11 00:00:43,890 --> 00:00:44,790 All right. 12 00:00:44,970 --> 00:00:48,810 And apparently each apple is going to cost $0.40. 13 00:00:48,810 --> 00:00:51,810 So let's go ahead and create a price variable. 14 00:00:52,440 --> 00:00:57,150 Double price is equal to $0.40. 15 00:01:00,040 --> 00:01:03,970 Now, one customer walked in and he bought four apples. 16 00:01:05,910 --> 00:01:12,390 If each apple costs $0.40, then your profit should increase by four times the price. 17 00:01:12,750 --> 00:01:15,360 So here we'll say profit. 18 00:01:16,670 --> 00:01:23,510 We can increase the profit by adding to it the value on the right, which is going to be four times 19 00:01:23,510 --> 00:01:29,930 whatever the price of each apple is, I believe four times 0.4 is 1.6. 20 00:01:29,930 --> 00:01:33,410 So at this point we have made $1.6. 21 00:01:34,400 --> 00:01:39,370 The number of customers needs to increase by one because one customer walked in. 22 00:01:39,380 --> 00:01:42,800 So a number of customers plus equals one. 23 00:01:43,310 --> 00:01:49,680 And because we sold four apples, that means we have four less apples than what we started with. 24 00:01:49,700 --> 00:01:53,960 So we'll say number of apples minus equals four. 25 00:01:55,490 --> 00:01:56,000 All right. 26 00:01:56,000 --> 00:01:59,810 I'll let you pause the video and try the rest of these on your own. 27 00:02:06,730 --> 00:02:07,230 All right. 28 00:02:07,230 --> 00:02:11,990 Once you do all of that, you can embed each variable into a string. 29 00:02:12,000 --> 00:02:13,860 So I'll do the first one. 30 00:02:15,050 --> 00:02:21,380 I can break the string right over here and concatenate the profit variables as value. 31 00:02:22,130 --> 00:02:24,530 I'll let you pause the video and do the rest. 32 00:02:30,330 --> 00:02:31,100 Looking good. 33 00:02:31,110 --> 00:02:34,050 Finally, we can just run our code Java. 34 00:02:34,080 --> 00:02:34,590 See? 35 00:02:36,070 --> 00:02:37,960 Apple Store Java. 36 00:02:39,250 --> 00:02:41,740 Java Apple Store. 37 00:02:44,130 --> 00:02:49,770 And just like that, after a hard day's work, we made $89.6. 38 00:02:49,800 --> 00:02:56,290 Three customers loved our apples, and in total we have 276 apples left. 39 00:02:56,310 --> 00:02:58,380 We will be selling more tomorrow. 40 00:02:58,590 --> 00:02:59,370 Awesome.