1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
tiny-mole [99]
2 years ago
9

Complete the do-while loop to output every number form 0 to countLimit using printVal. Assume the user will only input a positiv

e number. For example, if countLimit is 5 the expected output will be 0 1 2 3 4 5
import java.util.Scanner;

public class CountToLimit {

public static void main (String [] args) {

Scanner scnr = new Scanner(System.in);

int countLimit = 0;

int printVal = 0;

// Get user input

countLimit = scnr.nextInt();

printVal = 0;

do {

System.out.print(printVal + " ");

printVal = printVal + 1;

} while ( /* Your solution goes here */ );

System.out.println("");

return;

}

}

Write a do-while loop that continues to prompt a user to enter a number less than 100, until the entered number is actually less than 100. End each prompt with newline Ex: For the user input 123, 395, 25, the expected output is:

Enter a number (<100):
Enter a number (<100):
Enter a number (<100):
Your number < 100 is: 25
import java.util.Scanner;

public class NumberPrompt {

public static void main (String [] args) {

Scanner scnr = new Scanner(System.in);

int userInput = 0;

/* Your solution goes here */

System.out.println("Your number < 100 is: " + userInput);

return;

}

}
Computers and Technology
1 answer:
elena-s [515]2 years ago
7 0

Answer:

PART ONE

  1. import java.util.Scanner;
  2. public class CountToLimit {
  3.    public static void main(String[] args) {
  4.        Scanner scnr = new Scanner(System.in);
  5.        int countLimit = 0;
  6.        int printVal = 0;
  7.        // Get user input
  8.        System.out.println("Enter Count Limit");
  9.        countLimit = scnr.nextInt();
  10.        do {
  11.            System.out.print(printVal + " ");
  12.            printVal = printVal + 1;
  13.        } while ( printVal<=countLimit );
  14.        System.out.println("");
  15.        return;
  16.    }
  17. }

PART TWO

  1. import java.util.Scanner;
  2. public class NumberPrompt {
  3.    public static void main (String [] args) {
  4.        Scanner scnr = new Scanner(System.in);
  5.        System.out.print("Your number < 100: ");
  6.       int  userInput = scnr.nextInt();
  7.      do {
  8.           System.out.print("Your number < 100: ");
  9.           userInput = scnr.nextInt();
  10.       }while (userInput>=100);
  11.        System.out.println("Your number < 100 is: " + userInput);
  12.        return;
  13.    }
  14. }

Explanation:

In Part one of the question, The condition for the do...while loop had to be stated this is stated on line 14

In part 2, A do....while loop that will repeatedly prompt user to enter a number less than 100 is created. from line 7 to line 10

You might be interested in
Decision trees are onlyapplicable to problems under certainty.<br> True<br> False
lions [1.4K]

Answer: False

Explanation:Decision tree is the tree like structured flowchart which is used for the evaluation of the possible outcomes or result of the particular problem. It usually has two or more branches as the the result node . Decision tree are applicable to many problems for solving it. So, decision trees is not only applicable on certainty problems but also on other problems as well. Therefore the given statement is false.

6 0
3 years ago
In what year did alienware introduce alienfx lighting zones into their pc's?
ser-zykov [4K]
The answer to the question asked  above is 2006. 
<span>Alienware introduce alienfx lighting zones into their pc's on 2006.</span>

Hope my answer would be a great help for you.    If you have more questions feel free to ask here at Brainly.
8 0
3 years ago
Define types of hacker ?plz help me with this question​
denis-greek [22]

Answer:

the types of hacker attacks and techniques. White Hat Hackers. Black Hat Hackers. Gray Hat Hackers. Script Kiddies.

Explanation:

i don't know if this can help you

8 0
2 years ago
Read 2 more answers
Can someone please answer this? It isn't Insert
enyata [817]

Answer:

The answer for this question is b Add to

3 0
2 years ago
Which of the following is NOT a reason to use cryptography?
Mars2501 [29]

Cryptography is not a reason to use when posting photos on a public social media website.

Cryptography is the use of certain techniques that help protect important and personal information from being accessed by other parties. This technological practice or method allows a person to send sensitive or personal information over the internet without risking any "leak" of information.

  • Cryptography literally means "hidden writing", which is what the method is all about.
  • It presents a safe and secure way of sending or passing information, even personal or sensitive ones.
  • This technological method enables businesses and other companies as well as individuals to procure and send information without fearing for any loss of their information.
  • Cryptography is mainly used in the military, secret operations, businesses, or even in maintaining one's passwords while using social media platforms or submitting a password on a website.
  • One reason to not use it is when posting photos on social media websites as the website is to be used by the web world and may/can be accessed by everyone around the world.

Cryptography not only allows a person to maintain certain privacy and security but also help the smooth functioning of businesses and other national security works. Thus, cryptography is the "security" of individuals in the 'internet world'.

Learn more about cryptography here:

brainly.com/question/88001

5 0
2 years ago
Read 2 more answers
Other questions:
  • Think of a game you are familiar with and identify at least three team responsibilities which were required to make the game, on
    5·1 answer
  • What function does the ALU perform?
    10·1 answer
  • The while loop has two important parts: a condition that is tested and a statement or block of statements that is repeated as lo
    8·1 answer
  • How to search for the largest files on my computer vista?
    5·1 answer
  • Martha and her project group want to present the class their work in the form of a slideshow that includes charts. Which applica
    9·1 answer
  • Deleting anitem from a linked list is best when performed using two pointersso that the deleted item is freed from memory.
    7·1 answer
  • Declare an ArrayList of Strings. Add eight names to the collection. Output the Strings onto the console using the enhanced for l
    9·1 answer
  • If i keep giving out brainlyest will i get banned again?
    12·2 answers
  • If 209g of ethanol are used up in a combustion process, calculator the volume of oxygen used for the combustion at stp​
    5·1 answer
  • Question 5 of 10
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!