Using a for Loop NewMultiply.java 1 // NewMultiply.java - This program prints the numbers ® through 10 along 2 // with these values multiplied by 2 and by 10. Summary 3 // Input: None. 4 |/ Output: Prints the numbers ® through 10 along with their values multiplied by 2 and by 10 In this lab the completed program should print the 5 numbers O through 10, along with their values multiplied 7 public class NewMultiply 8 { public static void main(String args[]) { 11 by 2 and by 10. You should accomplish this using a for loop instead of a counter-controlled while loop. 9 10 Instructions String headi = "Number: "; String head2 = "Multiplied by 2: "; String head3 = "Multiplied by 10: "; 12 1. Write a for loop that uses the loop control variable 13 14 to take on the values O through 10. // Numbers 0 through 10. // Stores the number multiplied by 10. // Stores the number multiplied by 2. final int NUM_LOOPS = 10; // Constant used to control loop. 15 int numberCounter; 2. In the body of the loop, multiply the value of the loop 16 int byTen; control variable by 2 and by 10. 17 int byTwo; 18 19 20 3. Execute the program. Is the output the same? // This is the work done in the housekeeping() method System.out.println("® through 10 multiplied by 2 and by 10" + "\n"); 21 Grading 22 // This is the work done in the detailLoop() method // Write for loop 23 When you have completed your program, the Submit 24 button to record your score. 25 26 // This is the work done in the endOfJob() method System.exit(@); } // End of main() method. 27 28 29 30 } // End of NewMultiply class.
Using a for Loop NewMultiply.java 1 // NewMultiply.java - This program prints the numbers ® through 10 along 2 // with these values multiplied by 2 and by 10. Summary 3 // Input: None. 4 |/ Output: Prints the numbers ® through 10 along with their values multiplied by 2 and by 10 In this lab the completed program should print the 5 numbers O through 10, along with their values multiplied 7 public class NewMultiply 8 { public static void main(String args[]) { 11 by 2 and by 10. You should accomplish this using a for loop instead of a counter-controlled while loop. 9 10 Instructions String headi = "Number: "; String head2 = "Multiplied by 2: "; String head3 = "Multiplied by 10: "; 12 1. Write a for loop that uses the loop control variable 13 14 to take on the values O through 10. // Numbers 0 through 10. // Stores the number multiplied by 10. // Stores the number multiplied by 2. final int NUM_LOOPS = 10; // Constant used to control loop. 15 int numberCounter; 2. In the body of the loop, multiply the value of the loop 16 int byTen; control variable by 2 and by 10. 17 int byTwo; 18 19 20 3. Execute the program. Is the output the same? // This is the work done in the housekeeping() method System.out.println("® through 10 multiplied by 2 and by 10" + "\n"); 21 Grading 22 // This is the work done in the detailLoop() method // Write for loop 23 When you have completed your program, the Submit 24 button to record your score. 25 26 // This is the work done in the endOfJob() method System.exit(@); } // End of main() method. 27 28 29 30 } // End of NewMultiply class.
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
![Using a for Loop
NewMultiply.java
1 // NewMultiply.java - This program prints the numbers 0 through 10 along
2 // with these values multiplied by 2 and by 10.
3 // Input: None.
4 |/ Output: Prints the numbers 0 through 10 along with their values multiplied by 2 and by 10.
Summary
In this lab the completed program should print the
5
numbers O through 10, along with their values multiplied
by 2 and by 10. You should accomplish this using a for
7 public class NewMultiply
8 {
loop instead of a counter-controlled while loop.
public static void main(String args[])
{
10
Instructions
11
12
String headl = "Number: ";
1. Write a for loop that uses the loop control variable
13
String head2 = "Multiplied by 2: ";
14
String head3 = "Multiplied by 10: ";
to take on the values 0 through 10.
// Numbers 0 through 10.
// Stores the number multiplied by 10.
// Stores the number multiplied by 2.
final int NUM_LOOPS = 10; // Constant used to control loop.
15
int numberCounter;
2. In the body of the loop, multiply the value of the loop
16
int byTen;
17
int byTwo;
control variable by 2 and by 10.
18
3. Execute the program. Is the output the same?
19
// This is the work done in the housekeeping() method
System.out.println("0 through 10 multiplied by 2 and by 10" + "\n");
20
21
Grading
22
// This is the work done in the detailLoop() method
// Write for loop
23
When you have completed your program, click the Submit
24
button to record your score.
25
26
// This is the work done in the endOf Job() method
System.exit(®);
} // End of main() method.
27
28
29
30 } // End of NewMultiply class.
31](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F862c34ee-e27f-46b4-a2d2-ab5f4ef78243%2F6b73d12b-1f4e-4969-983c-f71ec54b5ffb%2F3tsoey_processed.png&w=3840&q=75)
Transcribed Image Text:Using a for Loop
NewMultiply.java
1 // NewMultiply.java - This program prints the numbers 0 through 10 along
2 // with these values multiplied by 2 and by 10.
3 // Input: None.
4 |/ Output: Prints the numbers 0 through 10 along with their values multiplied by 2 and by 10.
Summary
In this lab the completed program should print the
5
numbers O through 10, along with their values multiplied
by 2 and by 10. You should accomplish this using a for
7 public class NewMultiply
8 {
loop instead of a counter-controlled while loop.
public static void main(String args[])
{
10
Instructions
11
12
String headl = "Number: ";
1. Write a for loop that uses the loop control variable
13
String head2 = "Multiplied by 2: ";
14
String head3 = "Multiplied by 10: ";
to take on the values 0 through 10.
// Numbers 0 through 10.
// Stores the number multiplied by 10.
// Stores the number multiplied by 2.
final int NUM_LOOPS = 10; // Constant used to control loop.
15
int numberCounter;
2. In the body of the loop, multiply the value of the loop
16
int byTen;
17
int byTwo;
control variable by 2 and by 10.
18
3. Execute the program. Is the output the same?
19
// This is the work done in the housekeeping() method
System.out.println("0 through 10 multiplied by 2 and by 10" + "\n");
20
21
Grading
22
// This is the work done in the detailLoop() method
// Write for loop
23
When you have completed your program, click the Submit
24
button to record your score.
25
26
// This is the work done in the endOf Job() method
System.exit(®);
} // End of main() method.
27
28
29
30 } // End of NewMultiply class.
31
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 2 steps with 1 images

Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education