Java Bootcamp – Workbooks and Challenges
)}

Workbook 6.12

From Java Bootcamp Resources -> Module 1 -> 6\. Arrays, open Workbook 6.12.

Lottery Tickets!

Today you're feeling lucky, so you decide to buy lottery tickets!

Task 1


At the Java Jackpot, there are 6 winning numbers. You're feeling good about the numbers:

int[] ticket = {34, 43, 45, 65, 21, 54};

Using Arrays.copyOf(), copy all the elements of ticket into a variable: ticket2. But, change the third value to 54.

34 -- 43 -- 54 -- 65 -- 21 -- 54.

Task 2


Create a function that prints the ticket numbers.

/** Task 2 * Function name -- printTicketNumbers * @param ticket ( int[] ) * * Inside the function: * 1. print the numbers in one line. * i.e 1 4 6 3 2 6 * 2. add a new line */

Call the function for each ticket:

Good Luck!

Feedback Summary
4.8
38 students
5

92%
4

3%
3

0%
2

0%
1

5%
Written Reviews
There are no written reviews yet.