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
AlladinOne [14]
2 years ago
7

Write a complete Java program called Rooter that gets a positive integer called "start" from the user at the command line and th

en finds the squareroot of every number from "start" down to 0. Use a while loop to count down. Print each square root on a separate line. Include data validation to ensure the user provides a positive integer. Assume that the user enters an integer, and for validation, just check to be sure it is positive. If the validation is not passed, provide the user with suitable feedback and stay in the program to let the user try again until valid input is received. Use the Math.sqrt(double a) method to find each square root.
Computers and Technology
1 answer:
Nataly_w [17]2 years ago
4 0

Answer:

The program in Java is as follows:

import java.util.*;

import java.lang.Math;

public class Rooter{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

 int start;

 System.out.print("Start: ");

 start = input.nextInt();

 while(start<=0){

     System.out.print("Number must be positive\nStart: ");

     start = input.nextInt();  }

 while(start>=0){

     System.out.println(Math.sqrt(start));

     start--;  }

}

}

Explanation:

This declares start as integer

 int start;

This prompts the user for input

 System.out.print("Start: ");

This gets input for start

 start = input.nextInt();

The following is repeated until the user input is valid i.e. positive

<em>  while(start<=0){</em>

<em>      System.out.print("Number must be positive\nStart: ");</em>

<em>      start = input.nextInt();  }</em>

The following while loop prints the square root of each number till 0

<em>  while(start>=0){</em>

<em>      System.out.println(Math.sqrt(start));</em>

<em>      start--;  }</em>

You might be interested in
Ten(10) examples of wearables or wearable technologies?​
Semmy [17]

Answer:read

Explanation:

airpods

headphones

earbuds

AirPods  pro

watch

fitbit (type of watch that counts your miles) &you can say workout watch&

VR set

technology bracelet

smart glasses

Smart ring

7 0
3 years ago
The process of determining that a user has permission to perform a particular action on a computer is called
Doss [256]
I believe that would be authorization.
5 0
3 years ago
Write a pseudocode method swap(aList, i, j) that interchanges the items currently in positions i and j of a list. Define the met
serious [3.7K]

Answer:

Explanation:

The following pseudocode for this method using operations of the ADT list would be the following

swap(aList, indexI, indexJ) {

    initialize temp_variable = Retrieve(indexI, aList)

    Insert(Retrieve(indexJ, aList), indexI, aList)

    Insert(Retrieve(indexI, aList), temp_variable, aList)

}

This code basically saves the aList index of i , into a temporary Variable. Then it sets the aList index of i to the value of the element in index of j. Then it does the same for the index of j with the tem_variable. If we assume that the indexes of i and j exist, then it can crash our entire program if those indexes are missing from the list when we try to access them.

6 0
3 years ago
What is the name of the app that works like a emp jammer from your iphone app
lions [1.4K]

To my knowledge there is not one if that did somehow occour, it would result in your phone also getting fried by the EMP and render the app useless before it effected anybody else's phone or other devices. hope this answered your question:)

4 0
3 years ago
Which of the following methods is a static method? The class in which the method is defined is given in parentheses following th
maw [93]

Answer:

C. sqrt(Math)

Explanation:

All but one of options A to E are is not a static method.

Only option C is a static method. The sqrt() is a static method of Math, that can always be used as Math.sqrt() is used;

The Math class defines all of its methods to be static. Invoking Math methods is done by using Math as a method rather than a variable of type Math; this means that sqrt(Math) doesn't rely on instance variables and don't need to be overridden, unlike others.

Lastly, sqrt(Math) is a static method because unlike other options, it is an utility method, and it is relevant to computations on primitive data types.

The purpose of the static method is in large part to offer a standard library of functions, and it doesn't need to be applied directly to an object.

4 0
3 years ago
Other questions:
  • I got a 52 on my test :(
    15·1 answer
  • A drop-down menu must be contained by
    5·1 answer
  • What are the reasons why is it necessary to evaluate online sources and content?
    6·1 answer
  • What is IaaS? For this service model, what are the resources the cloud vendor will provide/manage and what are the resources the
    15·1 answer
  • ​open-source software is​ ________.
    11·1 answer
  • Statement Widgets or gadgets are _____ programs that appear on the desktop and display little pieces of information such as a ca
    5·1 answer
  • Please help!<br><br> What is a non-iterative programming structure?
    11·1 answer
  • Which career qualification is unique to the Energy Transmission career pathway and not to the Energy Distribution pathway? color
    10·2 answers
  • A while loop uses a(n) ___________ at the top of every iteration to test whether to continue or not.
    13·1 answer
  • 70 point Brainlist to best answer
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!