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
Many inventions have enabled us to use digital cameras. The biggest difference between traditional and digital cameras is that d
Andreyy89

1 Film Roll Vs SD card.

2 No LCD Display Vs LCD Display

3 No mega Pixels Vs Mega Pixels

4 Zero Optical zoom Vs Optical Zoom

5 No Picture Modes Vs Different Picture Modes

6 Limited Number of Pics per roll Vs unlimited number of pictures depending upon the size of a Card

7 Hassle of developing pictures Vs no hassle, simply transfer them to the pc/laptop

8 Limited features Vs multiple features

hope this helps

8 0
3 years ago
An administrator needs to set up an authentication server for users connecting to a network through a VPN. What kind of server c
nalin [4]

Answer:

RADIUS

Explanation:

RADIUS is the networking protocol that is used for the purpose of authentication to access the network resources. The full form of RADIUS is Remote Authentication Dial In User Service. It is used by different organizations, which setup their own network that can be accessible through VPN, DSL or modems through different networks. The purpose of this protocol is to establish the security and authentication mechanism by organization itself.

So, If an administrator needs to set up an authentication server for users connecting to a network through a VPN, he should establsih the RADIUS based Server.

3 0
3 years ago
If wearing protective gloves, there's no need to wash your hands after exposure to blood.
Nataliya [291]

Answer:

No, still wash hands

Explanation:

5 0
2 years ago
​Five elements that can prove the genuineness of a user. What you know, what you have, what you are, what you do, and where you
nataly862011 [7]

Authentication factors are the factors that describe about the ingenuition or origination of the user. This is the tag that tells about the actuality of user that is getting connected with internet by the five elementals.

Hope this helps!

8 0
3 years ago
Daiki is creating a database for a paint store. Each color of paint would have its own record which will include the color name
egoroff_w [7]

Answer:

The answer to this question is given below in the explanation section.

Explanation:

The correct answer to this question is c)field.

As we know that the feature of an entity is represented by its attribute in the database table. A database table is a set of records of different fields. Each field represents a row in a database table. Each field can contain a set of attributes related to an entity such as a paint color.

So the price of paint will be in its own field. Because there are different colors in the database table. Each color has its own record in form of a field. As you know that each field is a row in the database table. So, each row has the price of a paint color.

Other options are not correct because:

The table contains a list of fields and each field contains its own paint price. The format and file is something different and does not have any relation with the question scenario.

3 0
3 years ago
Read 2 more answers
Other questions:
  • Students can use eNotes to type notes directly on screen and
    11·2 answers
  • The _____ is a narrative description of the product, service, or information system.
    7·1 answer
  • In the written Hawaiian language, only 13 letters are used: the five vowels (a,e,i,o, and u), and 8 consonants (h,k,l,m,n,p,w, a
    10·1 answer
  • Once artwork is inserted into a placeholder, it can be moved around on a slide. True False
    9·1 answer
  • Pleaseeee help me w this!
    10·1 answer
  • The piece of hardware that contains the circuitry that processes the information coming in to the computer and tells the other h
    8·1 answer
  • Which of the following answers refers to a system containing mappings of domain names to various types of data, such as numerica
    15·1 answer
  • Write at least and explain four types of escape sequences and create an example in an IDE which consist of the mentioned escape
    7·1 answer
  • Firewalls are available as a special hardware device or as software. A firewall will block packets of information that are from
    7·1 answer
  • If there is a secure socket layer in place, what will you need in addition to a user id in order to access the shared files?.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!