Problem 1: Array basics

Task 1: Printing

We’ve created an array of existing restaurants in our system! We need your help to print out everything so we do not include the same restaurants.

  1. Use a for Loop to print out on below.
  2. Use the length() method to find the size of the array!
  3. Look at example below!

If we are given the array below:

String[] restaurants = { "Burger King", "Chipotle", "Panda Express", "McDonalds" };

the answer should print out:

String answer = "Burger King,Chipotle,Panda Express,McDonalds";

Task 2: Changing Elements

Oh no! McDonalds is out of food! Change the restaurant list before people start ordering from McDonalds, and be disappointed with no food. Luckily “Pizza Hut” is willing to help out! Replace McDonalds with Pizza Hut in the index.

  1. Find the index of McDonalds first
  2. Remember quotes around "Pizza Hut"
  3. Look at the example below!

String[] restaurants = {"Burger King", "Chipotle", "Panda Express", "McDonalds"};
//replace "McDonalds" with "Pizza Hut"