Workbook 6.5
From the Java Bootcamp Resources
, launch Workbook 6.5
.
Task 1
Make a function that returns a random number between 0 to 49999.
/** * Function name - randomNumber * @return (int) * * Inside the function * - returns a random number between 0 to 49999 * */
Task 2
Create an array that stores 10 random numbers.
Task 3
Use a for
loop to print every element on the same line. Leave one space between each element.
Here are the scores: 14775 48328 7928 27102 21787 21063 38096 42711 32863 23707
Task 4
Your code contains a highScore
variable.
int highScore = 0;
Use a for
loop to update the variable with the highest score in the array, and print it.
Hint: your loop needs a condition that updates the variable whenever an element is higher.
Result
Visualizing the Runtime
After you solve this workbook, I still recommend watching the video solution on Udemy.
It will show you how to visualize the runtime using Visual Studio Code.
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.