subject

In this lab, you use a counter-controlled While loop in a Java program provided with the data files for this book. When completed, the program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. The Data file contains the necessary variable declarations and output statements.
1. Open the source code file named Multiply. java using Notepad or the text editor of your choice.
2. Write a counter-controlled While loop that uses the loop control variable to take on the values 0 through 10. Remember to initialize the loop control variable before the program enters the loop.
3. In the body of the loop, multiply the value of the loop control variable by 2 and by 10. Remember to change the value of the loop control variable in the body of the loop.
4. Save the source code file in a directory of your choice, and then make that directory your working directory.
5. Compile the source code file Multiply. java.
6. Execute the program. Record the output of this program.

Multiply. java file

//Lab 5-1: Using a Counter-Controlled while Loop
// Multiply. java - This program prints the numbers 0 through 10 along
// with these values multiplied by 2 and by 10.
// Input: None.
// Output: Prints the numbers 0 through 10 along with their values multiplied by 2 and by 10.

public class Multiply
{
public static void main(String args[])
{

String head1 = "Number: ";
String head2 = "Multiplied by 2: ";
String head3 = "Multiplied by 10: ";
int numberCounter; // Numbers 0 through 10.
int byTen; // Stores the number multiplied by 10.
int byTwo; // Stores the number multiplied by 2.
final int NUM_LOOPS = 10; // Constant used to control loop.

// This is the work done in the housekeeping() method
System. out. println("0 through 10 multiplied by 2 and by 10" + "\n");

// This is the work done in the detailLoop() method
// Initialize loop control variable.
numberCounter = 0;
// Write your counter controlled while loop here

// This is the work done in the endOfJob() method
System. exit(0);
} // End of main() method.

} // End of Multiply class.

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 23:30
Acomputer is a multipurpose device that accepts input, processes data, stores data, and produces output, all according to a series of stored . the processing unit of most modern computers is a(n) . the instructions that tell a computer how to carry out a task are referred to as computer , which are distributed as software. computers run three main types of software: software, system software, and development tools. an example of system software is a computer system, which is essentially the master controller for all the activities that a digital device performs. digital devices are constructed using tiny electronic components that represent data bits as electrical signals. the system unit houses the system board, which contains several circuits made from semiconducting materials. computers come in three popular form factors: component, , and slate. many of today's digital devices operate on battery power supplied by ion batteries. battery life and lifespan can be extended by following good battery management practices.
Answers: 3
question
Computers and Technology, 22.06.2019 02:30
If you turn on the lock alpha button , what happens
Answers: 1
question
Computers and Technology, 22.06.2019 17:30
Ou listened to a song on your computer. did you use hardware or software?
Answers: 2
question
Computers and Technology, 23.06.2019 03:00
Your business be in google top rank.more the rank more the business leads.for best seo and digital marketing services be confident to contact you can get best seo solutions by assistance experts provide digital marketing, website development, seo expert services and social media internet seo expert services your branding solutions. seo expert services ,best seo expert services,online seo expert services,
Answers: 3
You know the right answer?
In this lab, you use a counter-controlled While loop in a Java program provided with the data files...
Questions
question
Mathematics, 23.02.2021 21:50
question
Physics, 23.02.2021 21:50
question
Mathematics, 23.02.2021 21:50
question
Mathematics, 23.02.2021 21:50
Questions on the website: 13722362