In this lab the completed program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. You should accomplish this using a for loop instead of a counter- controlled while loop.
In this lab the completed program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. You should accomplish this using a for loop instead of a counter- controlled while loop.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
![Using a for Loop
NewMultiply.java
>_ Terminal
1 // NewMultiply.java - This program prints
the numbers ® through 10 along
Summary
2 // with these values multiplied by 2 and by
10.
In this lab the completed program
3 // Input: None.
4 |/ Output: Prints the numbers 0 through 10
should print the numbers 0
through 10, along with their values
along with their values multiplied by 2 and
multiplied by 2 and by 10. You
by 10.
5
should accomplish this using a
for loop instead of a counter-
7 public class NewMultiply
8 {
public static void main(String args[])
{
controlled while loop.
9
10
Instructions
11
12
String head1 = "Number: ";
1. Write a for loop that uses
13
String head2 = "Multiplied by 2: ";
the loop control variable to
14
String head3 = "Multiplied by 10:
";
take on the values O through
15
int numberCounter;
// Numbers 0
10.
through 10.
2. In the body of the loop,
16
int byTen;
// Stores the number
multiplied by 10.
int byTwo;
multiply the value of the loop
// Stores the
17](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fbeaa653a-e357-4f33-b0c0-c7b092496d72%2F866701fe-b79b-48cb-9f7e-5121b9fe656e%2Fqb2g5x_processed.png&w=3840&q=75)
Transcribed Image Text:Using a for Loop
NewMultiply.java
>_ Terminal
1 // NewMultiply.java - This program prints
the numbers ® through 10 along
Summary
2 // with these values multiplied by 2 and by
10.
In this lab the completed program
3 // Input: None.
4 |/ Output: Prints the numbers 0 through 10
should print the numbers 0
through 10, along with their values
along with their values multiplied by 2 and
multiplied by 2 and by 10. You
by 10.
5
should accomplish this using a
for loop instead of a counter-
7 public class NewMultiply
8 {
public static void main(String args[])
{
controlled while loop.
9
10
Instructions
11
12
String head1 = "Number: ";
1. Write a for loop that uses
13
String head2 = "Multiplied by 2: ";
the loop control variable to
14
String head3 = "Multiplied by 10:
";
take on the values O through
15
int numberCounter;
// Numbers 0
10.
through 10.
2. In the body of the loop,
16
int byTen;
// Stores the number
multiplied by 10.
int byTwo;
multiply the value of the loop
// Stores the
17

Transcribed Image Text:+
Using a for Loop
NewMultiply.java
>- Terminal
16
int byTen;
// Stores the number
multiplied by 10.
int byTwo;
Instructions
17
// Stores the
number multiplied by 2.
1. Write a for loop that uses
18
final int NUM_LOOPS = 10; // Constant
the loop control variable to
used to control loop.
19
take on the values O through
20
// This is the work done in the
10.
housekeeping () method
System.out.println("0 through 10
multiplied by 2 and by 10" + "\n");
21
2. In the body of the loop,
multiply the value of the loop
22
control variable by 2 and by
23
// This is the work done in the
detailloop() method
24
10.
// Write for loop
3. Execute the program. Is the
25
// This is the work done in the
endof Job() method
26
output the same?
System.exit(0);
} // End of main() method.
27
Grading
28
29
When you have completed your
30 } // End of NewMultiply class.
31
program, click the Submit button
32
to record your score.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY