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
icon
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
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education