Java Bootcamp – Workbooks and Challenges

Workbook 6.10

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

Pizza Delivery

In this workbook, the user is ordering a pizza. Your app will ask the user what toppings they want before dispatching a driver.

Task 1

Ask the user: How many pizza toppings do you want?. Then, pick up the result using Scanner.

Task 2

Create a String[] array toppings that can store the number of toppings requested.

Task 3

  • Print: Great, enter each topping!

  • Create a for loop that runs through the length of the array.

Task 4

Inside the for loop:

  1. Print each index number followed by a dot.

  2. Beside the number, pick up the user's topping and store it in the array.

Be careful from the nextLine() trap (see cheat sheet).

This task is tricky.

Task 5

After the user enters every topping, print

  • \nThank you! Here are the toppings your ordered

  • Create a for loop that runs through the length of the array and prints each topping:

Task 6

If you made it to task 5, you're almost home-free!

  • Print: \nPress anything to confirm your order.

  • Once the user confirms the order, print: Great, a driver is on the way!

Good Luck!

Feedback Summary
39 students





Written Reviews
There are no written reviews yet.