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
lorasvet [3.4K]
4 years ago
15

How long after you install a new toilet until you can use it?

Computers and Technology
1 answer:
Marrrta [24]4 years ago
3 0
You can use it immediately after installation.
You might be interested in
Write a simple command-line calculator with an exception handler that deals with nonnumeric operands. Your program should displa
alexira [117]

Answer:

Here is the JAVA program:

import java.util.InputMismatchException;  // exception that is thrown when input does not match the expected type

import java.util.Scanner;  //used to take input from user

public class Main {

public static void main(String[] args) { //start of main function

   Scanner input = new Scanner(System.in);  // creates Scanner class object

   double num1=0.0;  // double type operand 1

   double num2=0.0;  // double type operand 2

   System.out.println("Please enter 2 operands");  //prompts user to enter two operands

   try {  //defines a chunk of code to be tested for non numeric operand error

      num1 = input.nextDouble();  //reads operand 1 value

      num2 = input.nextDouble(); //reads operand 2 value

         

   } catch (InputMismatchException  ex) {  //code chunk executed when exception occurs in program

     System.out.println("wrong operand type, re-input " + input.next() + " to finish the calculation.");  //displays wrong operand type if user enters non numeric operands

     System.exit(1);  }//exits the program    

   System.out.print("Enter an operator (+, -, *, /): ");  //prompts user to enter an operator

       char operator = input.next().charAt(0);  //reads the input operator

       double result;  // to store the result of the operation

       switch(operator)         {  //decided operation on basis of input operator

           case '+':  // if user enters + operator

               result = num1 + num2;  //adds two operands

               break;

            case '-':  // if user enters - operator

               result = num1 - num2;  //subtracts two operands

               break;  

           case '*':  // if user enters * operator

               result = num1 * num2;  //multiplies two operands

               break;  

           case '/':  // if user enters / operator

               result = num1 / num2;  //divided two operands

               break;  

           default:  //if user enters wrong operator

               System.out.printf("wrong operator!");  //displays wrong operator

               return;          }  

       System.out.printf("%.1f %c %.1f = %.1f", num1, operator, num2, result); }} //displays the result of the operation

Explanation:

The program is well explained in the comments mentioned with each line of program. The user is prompted to enter the values of two operands num1 and num2. The try block is used to test for non numeric operand error and throws InputMismatchException when any of the input operands (num1 or num2) is non numeric. InputMismatchException is thrown by Scanner class. This informs that the token retrieved (which is the num1 or num2 operand) does not match the expected type (which is type numeric). When this error occurs in the program, catch block is used to execute a code chunk, which is the print statement in this program. The print statement informs the user of the wrong operand type before exiting. It also asks the user to re-input the number to finish the calculation and the wrong input type is also mentioned in the output that is to be re-input.

If you want the program to take the input again from user after throwing this exception then you can alter the above program by using two try catch blocks separately for the two operands:

//for operand 1 i.e. num1

System.out.println("Please enter operand 1: ");

   try {

      num1 = input.nextDouble();        

   } catch (InputMismatchException  ex) {

     System.out.println("wrong operand type, re-input " + input.next() + " to finish the calculation.");

      num1 = input.nextDouble();  }  //reads input of operand 1 again from user

//for operand 2 i.e. num2

          System.out.println("Please enter operand 2: ");  

      try {

      num2 = input.nextDouble();  

   } catch (InputMismatchException  ex) {

     System.out.println("wrong operand type, re-input " + input.next() + " to finish the calculation.");

     num2 = input.nextDouble();  } //reads input of operand 1 again from user

The program and its output is attached.

8 0
4 years ago
Some request lists might cause the disk scheduler to act the same when the three different algorithms are run. Create a request
storchak [24]

Answer:

35, 25, 50, 75, 95

Explanation:

List of five track numbers that will cause all three algorithms to visit the same tracks in the same order are -

35

25

50

75

95

Please go to attachment for the diagram how these 5 tracks will be traversed by various algorithms.

All the algorithms traverse in the order 35 -> 25 -> 50 -> 75 -> 95

7 0
3 years ago
Q: The first step to format your spreadsheet data is to _____
Semmy [17]
Add your headings in the row of cells at the top of the sheet
6 0
2 years ago
"The network layer is responsible for transferring packets of data from the A.Source computer to the destination computer on adj
galben [10]

Answer:

Source computer to the destination computer via one of more networks

Explanation:

The network layer provides the means of transferring variable-length network packets from a source to a destination host via one or more networks.

3 0
3 years ago
What technique is used to separate the different cell parts?
Brut [27]
This should be in Science/Biology
5 0
3 years ago
Other questions:
  • Is the protocol that specifies how web browsers and servers communicate.?
    11·1 answer
  • The desktops of computers running the same OS all look the same
    8·1 answer
  • A user is connecting to an e-commerce server to buy some widgets for a company. the user connects to the site and notices there
    10·1 answer
  • in a management information system, the quality of information is determined by its usefulness to users, and its usefulness dete
    8·1 answer
  • Write an essay of at least 300 words explaining your position on a proposed ban of Wikipedia in your future college. You should
    12·1 answer
  • Which type of weathering creates karst topography?
    5·1 answer
  • The following shared data structures must be declared as global variables such that they are shared by all threads
    7·1 answer
  • Which statement about parallax scrolling is true?
    6·1 answer
  • Practising some questions for board exams for class 12 python,pls help with detailed answer
    14·1 answer
  • Importance of software in computer​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!