Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create this program in java using the instructions given below. 50 Points Constants, Looping and Iteration The purpose of this homework is to get you

Create this program in java using the instructions given below. image text in transcribed
50 Points Constants, Looping and Iteration The purpose of this homework is to get you to utilize looping and iteration in your programs. Also, you should know how to declare a constant (versus declaring a variable.) Steps: 1) (3 points) Create a new project in Eclipse (like how you did with Homework #1) but name this one "Homework3" 2) (2 points) Create a package named "Main" for the project (also like in Homework #1) 3) (2 points) Create a Java source code file named "Main.java" (also like in Homework #1) 4) (2 points) Open "Main.java" in your Code Editor window and copy /paste the boilerplate code from the "Hello, World" assignment into your "Main-java", file in Homework #3. (On Windows, Ctrl+ C is copy and Ctri + V is paste) 5) (1 points) Remove the "System.out.println(Hello, World..."): line from the boilerplate code so you start with an empty "main" method 6) (2 points) Declare an integer variable named "i" and initialize it to 0 7) (3 points) Declare a constant integer named "max" and initialize it with a value of 10 8) (12 points) Create a "while" loop that evaluates as long as "i" is less than "max" 9) (I points) Add the line "System.out.,printin(Integer.toString()" (don't type quotation marks!) inside the while loop brackets 10) (2 points) Underneath the previous line, use a Unary operator to increment "" by1 11) (5 points) Run the program and observe the console. Observe what the program does and add comments above the while loop code explaining to me what the while loop does (comments are done using either 1)// on each line OR 2)7 Comment between these! that your code works by running it and viewing the results in console) code works by running it and viewing the results in console) 12) (8 points) Below that, create the same routine but using the "do/ while" looping style (verify 13) (7 points) Below that, create the same routine but using the "for" looping style (verify that your 50 Points Constants, Looping and Iteration The purpose of this homework is to get you to utilize looping and iteration in your programs. Also, you should know how to declare a constant (versus declaring a variable.) Steps: 1) (3 points) Create a new project in Eclipse (like how you did with Homework #1) but name this one "Homework3" 2) (2 points) Create a package named "Main" for the project (also like in Homework #1) 3) (2 points) Create a Java source code file named "Main.java" (also like in Homework #1) 4) (2 points) Open "Main.java" in your Code Editor window and copy /paste the boilerplate code from the "Hello, World" assignment into your "Main-java", file in Homework #3. (On Windows, Ctrl+ C is copy and Ctri + V is paste) 5) (1 points) Remove the "System.out.println(Hello, World..."): line from the boilerplate code so you start with an empty "main" method 6) (2 points) Declare an integer variable named "i" and initialize it to 0 7) (3 points) Declare a constant integer named "max" and initialize it with a value of 10 8) (12 points) Create a "while" loop that evaluates as long as "i" is less than "max" 9) (I points) Add the line "System.out.,printin(Integer.toString()" (don't type quotation marks!) inside the while loop brackets 10) (2 points) Underneath the previous line, use a Unary operator to increment "" by1 11) (5 points) Run the program and observe the console. Observe what the program does and add comments above the while loop code explaining to me what the while loop does (comments are done using either 1)// on each line OR 2)7 Comment between these! that your code works by running it and viewing the results in console) code works by running it and viewing the results in console) 12) (8 points) Below that, create the same routine but using the "do/ while" looping style (verify 13) (7 points) Below that, create the same routine but using the "for" looping style (verify that your

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

More Books

Students also viewed these Databases questions