Question: Getting Started Create a class called Lab7. Use the same setup for setting up your class and main method as you did for the previous

Getting Started Create a class called Lab7. Use the same setup for setting up your class and main method as you did for the previous assignments. Be sure to name your file Lab7.java. An array will be used in this program. The overall goal of this lab is to allow the user to enter five integers into an array. The program will then print out each of these integers + 1. Part 1: Initial Setup The following needs to be done for the initial setup: Create a Scanner object - be sure to import the Scanner class Declare a constant int called SIZE - set it equal to 5 Create an array of ints called array of size SIZE Part 2: Filling the Array Using a loop, iterate through the array and use the Scanner class to read ints into all five positions in the array. A prompt for input is optional. See the lecture videos for examples of this being done. If this part is completed successfully, your array should contain five elements after the user enters five integers. Part 3: Displaying the Output To separate the outputs, include a println statement stating something along the lines of: Processing each array element... Now, write another loop which prints out 1 + each of the array?s elements on a separate line. For example, if one of the elements is 4, your program should print a 5. See below for a full example. Note It isnt necessary to prompt a user to input integers in the beginning. It isnt a problem if you do, though. It is possible to achieve the output of this lab without using arrays and with only one loop. However, that would defeat its purpose. Please use an array and please write out the two loops to complete this lab for full credit. Labs are not graded by a program, so you do not need to spend a large amount of time making the output match perfectly with the sample below. Do, however, make sure your output is reasonable. The goal here is for you to demonstrate that you understand the underlying concepts. Sample Output Below is an example of what your output should roughly look like when this lab is completed. All text in bold represents user input. Sample Run 1: 0 1 2 3 4 2 Processing each array element... 1 2 3 4 5 Sample Run 2: -5 6 0 1 1 Processing each array element... -4 7 1 2 2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!