Java Bootcamp – Workbooks and Challenges
)}

Workbook 2.3

From the Java-Bootcamp-Resources, launch the Workbook 2.3 folder.

Screen Shot 2022-10-10 at 11.38.36 PM.png

The Apple Store

The workbook starts with three variables.

int numOfApples = 0; int numOfCustomers = 0; double profit = 0;

Task 1

Decrease your number of apples based on the printed messages.

Screen Shot 2022-10-30 at 10.16.31 PM.png

Task 2

Increase your number of customers based on the printed messages.

Screen Shot 2022-10-30 at 10.21.15 PM.png

Task 3

Make a price variable and set it equal to 0.40.

Screen Shot 2022-10-30 at 10.25.44 PM.png

Increase your profits based on the number of apples sold, and the price of each apple.

Screen Shot 2022-10-30 at 10.29.03 PM.png

Task 4

Replace each placeholder with a variable.

Screen Shot 2022-10-30 at 10.30.54 PM.png

Result

>> Wow! So far, you made: $89.6
>> 3 customers love your apples.
>> You have 276 apples left. We'll sell more tomorrow!

Solution

The code solution is beside the starter project.

Screen Shot 2022-10-10 at 11.45.19 PM.png

The video solution is inside the appendix (last section on Udemy).

Screen Shot 2022-10-10 at 11.46.23 PM.png


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.