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
kolbaska11 [484]
3 years ago
8

If the user enters any operator symbol other than , -, *, or /, then an UnknownOperatorException is thrown and the user is allow

ed to reenter that line of input. Define the class UnknownOperatorException as a subclass of the Exception class. Your program should also handle NumberFormatException if the user enters non-numeric data for the operand.
Computers and Technology
1 answer:
Anna007 [38]3 years ago
7 0

Answer:

Explanation:

The following code is written in Java. It creates the UnknownOperatorException class and catches it if the user enters something other than the valid operators. If so it continues asking the user for a new input. Once a valid operator is entered, it exits the function and prints the operator.

import java.util.Scanner;

class Brainly {

   public static void main(String[] args) {

       char symbol = askForOperand();

       System.out.println("Operand: " + symbol);

   }

   public static char askForOperand() {

       Scanner in = new Scanner(System.in);

       try {

           System.out.println("Enter operator symbol: ");

           char symbol = in.nextLine().charAt(0);

           if ((symbol != '-') && (symbol != '*') && (symbol != '/')) {

               System.out.println(symbol);

               throw new UnknownOperatorException();

           } else {

               return symbol;

           }

       } catch (NumberFormatException | UnknownOperatorException e) {

           System.out.println("Not a valid operand");

           char symbol = askForOperand();

           return symbol;

       }

   }

}

class UnknownOperatorException extends Exception {

   public UnknownOperatorException() {

       System.out.println("Unknown Operator");

   }

}

You might be interested in
Will give brainliest!<br> Who created binary, and does anyone have any idea how?
Sphinxa [80]

Answer:

Gottfried Leibniz created it and Leibniz was trying to find a system that converts logic's verbal statements into a pure mathematical one.

6 0
2 years ago
A person appreciation of a food taste and flavor is commonly referred to as what
Nimfa-mama [501]

Answer:

Palate - A person’s appreciation of taste and flavor, especially when sophisticated and discriminating Eclectic - Deriving ideas, style, or taste from a broad and diverse range of sources Piquancy - A pleasantly sharp and appetizing flavor

6 0
2 years ago
The browser feature which enables tabs to work independently from one another so if one crashes, the others may continue to work
Mars2501 [29]

Answer:

Tab isolation

Explanation:

Tab isolation is a feature of the browser that works to protect your data from malware. its uses to enhance the reliability of the browser by considering the impact of the crash.

A browser without the tab isolation can be crash fully due to the crashing of one tab. this feature helps to recover the previous opening tab after crashing while on the previous version of the browser if one tab crashes then it automatically crashes all other tabs.

8 0
3 years ago
How to calculate a pid controller
pishuonlain [190]

Answer:

Control by PID1

is a control method often used for servos.

Don't you know what a bondage is? Well, it's a system, capable of reaching and

maintain a setpoint thanks to the measurements it performs.

Imagine, for example, in a car on the highway. You want to drive at 130Km / h

without having to press the accelerator. Your car's cruise control should

by itself maintain this speed. When approaching a slope the system "notices" that for

the same power at the level of the motor, it no longer reaches the 130 km / h setpoint and will add a

little acceleration. Yes but by how much? And how long will it take for the system to

stabilize around the setpoint?

That's the whole servo problem and PID control is one way to solve it!

PID is the most widely used regulator in industry. The idea of ​​this control body is to

intentionally modify the value of the error which remains between the setpoint and the measurement

performed.

For example in the case of a position control the error would be: ε = c (p) - s (p)

In the case of proportional control, the error is virtually amplified by a certain gain

constant that should be determined according to the system.

Setpoint (t) = Kp.ε (t)

What in Laplace gives:

Setpoint (p) = Kp.ε (p)

Explanation:

5 0
3 years ago
The common channel signaling (CCS) system provides a separate network dedicated to control and signaling over the PSTN. This ena
dezoksy [38]
The correct answer is A.True
8 0
2 years ago
Other questions:
  • Which hypervisor works on older pcs without hardware virtualization support?
    9·2 answers
  • А.<br> is the highest education degree available at a community college.
    6·1 answer
  • Operating systems provide a measure of security by allowing users to access to those resources they've been cleared to use as we
    8·1 answer
  • Circular errors are caused by adding the cell name of a/an _______ cell to a formula.
    6·2 answers
  • What is essential to delivering a successful presentation?
    5·2 answers
  • Charlie makes pizza at a restaurant. The customers always compliment how great the pizza tastes. But Charlie takes a long time t
    7·2 answers
  • Explain the following buttons as used in emails:compose,inbox and Draft.<br>​
    10·1 answer
  • (Correct Answer Recieves Brainliest)
    8·2 answers
  • How do you initiate a sprite’s actions in a scene?
    8·1 answer
  • Another name of computer program is
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!