If the user enters any operator symbol other than , -, *, or /, then an UnknownOperatorException is thrown and the user is allowed 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.

Answers

Answer 1

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");

   }

}

If The User Enters Any Operator Symbol Other Than , -, *, Or /, Then An UnknownOperatorException Is Thrown

Related Questions

How have technology and social media changed reading?
O A. Physical books can only be read on the web.
B. Now reading is a conversation of give and take.
O C. People no longer have to read anything at all.
D. Reading often takes much longer to undergo.

Answers

Answer:

B?

Explanation:

I'm super sorry if I get this wrong for you but after thinking so much I probably think it would be B

Answer:

the guy above is right it is B

Explanation:

because 2+2=4

b) Set of strings of 0s and 1s whose 5th symbol from left is 1.

Answers

Answer:

...?

Explanation:

1-How many moles of NazCOs are in 10.0 ml of a 2.0 M solution?​

Answers

Answer:

A solution is a mixture in which the particles are so small that the components are indistinguishable from each other. The amount of the solute and the solvent in a solution can be expressed in terms of different concentration expressions such as molarity, morality, etc.

Explanation:

To calculate the number of moles of sodium carbonate, the volume in liters will be multiplied by the molar concentration of the solution.

moles Na2CO3 = 2.0 M  x 0.0100 L = 0.020 moles Na2CO3

Hope it helps :)

Answer:

There are 20. mol of Na2CO3 in 10.0L of 2.0M solution.

Explanation:

Molarity is represented by this equation:

(look at attachment)

In our case, we already have the molarity and volume of solution, both of which have good units.

Let's rearrange the equation to solve for the number of moles. We can do this by multiplying by L solution on both sides of the equation. The L solution will cancel out on the right side, leaving the number of moles being equal to the molarity times volume:

Moles of solute

=Lsolution×Molarity

Now we just plug the known values in!

Moles of solute = (10.0 L) (2.0M) = 20. moles

write a program that takes as input a number of kilometers and prints the corresponding number of nautical miles.

Answers

Answer:

try this

Explanation:

km = float(input('Kilometers: '))

nm = (km * 5400) / 10000

print('%0.4f km = %0.4f Nautical Miles' %(km,nm))

What is the function of the NOS? Select all that apply.

•network management
•connects network nodes
•network security
•provides MACs
•gives access to privileges
•data protection

Answers

Answer:

.network management

Explanation:

pls need brainliest

Answer:

gives access privileges

network management

network security

data protection

Explanation:

4. Write a program to calculate square root and
cube root of an entered number .​

Answers

Answer:

DECLARE SUB SQUARE (N)

CLS

INPUT “ENTER ANY NUMBER”; N

CALL SQUARE(N)

END

SUB SQUARE (N)

S = N ^ 2

PRINT “SQUARE OF NUMBER “; S

END SUB

Linda wants to change the color of the SmartArt that she has used in her spreadsheet. To do so, she clicks on the shape in the SmartArt graphic. She then clicks on the arrow next to Shape Fill under Drawing Tools, on the Format tab, in the Shape Styles group. Linda then selects an option from the menu that appears, and under the Colors Dialog box and Standard, she chooses the color she wants the SmartArt to be and clicks OK. What can the option that she selected from the menu under Shape Fill be

Answers

Answer: Theme colors

Explanation:

Based on the directions, Linda most probably went to the "Theme colors" option as shown in the attachment below. Theme colors enables one to change the color of their smart shape.

It is located in the "Format tab" which is under "Drawing tools" in the more recent Excel versions. Under the format tab it is located in the Shape Styles group as shown below.

Select the correct answer.
What should you keep in mind when picking a topic for a research paper?
ОА.
choosing a general topic
OB.
choosing a topic that is relatively new
O C.
choosing a specific topic rather than a broad one
OD. choosing a topic based on the most number of sources you can find
Reset
Next

Answers

Answer: The answer is C

Explanation: When it comes to research papers your topic shouldnt be too broad. Your topic should be broad enough you can find a good amount of information but not too focused that you can't find any information.

what is the value of 2020/20×20​

Answers

Answer:.5.05

Explanation:...maths

Answer:

5.05

Explanation:

2020/400= 5.05

HOPE IT HELPED AND GOOD LUCK!!

What will the declaration below do to its target?

animation-direction: reverse;
The animation steps will play backward.
The animation steps will play forward, then backward.
The animation steps will play forward.
The animation steps will play backward, then forward.

Answers

The animation steps will play forward then backward

Write a program that will create an array of random numbers and output the values. Then output the values in the array backwards. SPECIFICATIONS: File name: ArrayBackwards.java Your program must make use of at least one method other than main()to receive full credit (methods can have a return type of void). Suggestion: create and populate the array in the main() method. Make a method for Step 3 below and send in the array as a parameter. Make another method for Step 4 and send in the array as a parameter.

Answers

Answer:

The program is as follows:

import java.util.*;

public class Main{

public static void backward(int [] Rndarray, int lnt){

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

    for(int itm = lnt-1;itm>=0;itm--){

        System.out.print(Rndarray[itm]+" ");     } }

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

 int lnt = input.nextInt();

 Random rd = new Random();

 int [] Rndarray = new int[lnt];

 for (int itm = 0; itm < lnt; itm++) {

        Rndarray[itm] = rd.nextInt();

        System.out.print(Rndarray[itm]+" ");

     }

     System.out.println();

 backward(Rndarray,lnt); }}

Explanation:

This defines the backward() method

public static void backward(int [] Rndarray, int lnt){

This prints string "Reversed"

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

This iterates through the array

    for(int itm = lnt-1;itm>=0;itm--){

Each element is then printed, backwards

        System.out.print(Rndarray[itm]+" ");     } }

The main begins here

public static void main(String[] args) {

 Scanner input = new Scanner(System.in);

This gets the array length

int  n = input.nextInt();

This creates a Random object

Random rd = new Random();

This declares the array

 int [] Rndarray = new int[lnt];

This iterates through the array for input

 for (int itm = 0; itm < lnt; itm++) {

This generates a random number for each array element

        Rndarray[itm] = rd.nextInt();

This prints the generates number

        System.out.print(Rndarray[itm]+" ");

     }

This prints a new line

     System.out.println();

This passes the array and the length to backward() method

 backward(Rndarray,lnt); }}

how do you record your own video game Music and post Them on yt

Answers

Answer:I would try downloading a beat app and making a song,then posting

Explanation:

You should use another electronic and record it from their

Sixteen stations, numbered 1 through 16, are contending for the use of a shared channel by using the adaptive tree walk protocol. If all the stations whose addresses are prime numbers suddenly become ready at once, how many bit slots are needed to resolve the contention

Answers

Answer:

11 bit slot will be needed

Explanation:

The number of prime numbers between 1 through 16

= 2, 3 , 5, 7, 11 and 13

hence we can say 6 stations are to use the shared channel

Given that all the stations are ready simultaneously

The number of bit slots that will be needed to handle the contention will be 11 bits :

slot 1 : 2, 3, 5 , 7, 11 , 13

slot 2 : 2,3, 5, 7

slot 3 : 2, 3

slot 4 : 2 .   slot 5 : 3 .  slot 6 : 5,7.   slot 7 : 5 .   slot 8 : 7.  slot 9: 11,13.  

slot 10 : 11.   slot 11 : 13

An OpenCL Device is composed of: Group of answer choices Command Queues Platforms Processing Elements Compute Units

Answers

Answer:

Compute Units

Explanation:

A platform can be defined as a computing environment for building and executing sets of code in a software application or program such as an application programming interface (API).

The two parts of the platform used to run an application software are both hardware and software (operating system).

Machine and assembly are referred to as a low level programming language used in writing software programs or applications with respect to computer hardware and architecture. Machine language is generally written in 0s and 1s, and as such are cryptic in nature, making them unreadable by humans but understandable to computers.

OpenCl is an abbreviation for open computing language that runs on CUDA-powered graphics processing units (GPUs). An OpenCL Device is composed of compute units and an OpenCl compute unit typically comprises of processing elements.

what is internet? explain help pliz​

Answers

The Internet, sometimes called simply "the Net," is a worldwide system of computer networks -- a network of networks in which users at any one computer can, if they have permission, get information from any other computer (and sometimes talk directly to users at other computers).

Select the correct term to complete the sentence.
The
file format is used for video files.

A. .pptx

B. .mp3

C. .jpeg

D. .mp4

Answers

Answer: D. mp4

its mp4 because its always on video files

hardware and costs of adding two levels of hardware RAID. Compare their features as well. Determine which current operating systems support which RAID levels. Create a chart that lists the features, costs, and operating systems supported.

Answers

Explanation:

1. Redundant batch of Inexpensive Drives (or Disks) (RAID) is a term for data storage schemes that divide and/or replicate data amid multiple hard drives.

2. RAID can be designed to provide increased data accuracy or increased Input/Output performance

Hardware RAID exists as a customized processing system, utilizing various controllers or RAID cards to control the RAID design independently from the OS. Software RAID utilizes the processing capacity of that computer's operating system in which the RAID disks exists installed.

What are the two types of RAID?

We have two kinds of RAID implementation through. Hardware and Software. Both these implementation contains its own benefits and drawbacks.

Software RAID does not count any cost for a RAID controller and exists fairly effortless to estimate the cost of as you exist only buying additional drives. All of our usual dedicated servers come with at least two drives, indicating there exists NO cost for software RAID 1, and stands positively suggested.  It exists positively suggested that drives in a RAID array be of the exact type and size. With RAID 0 or RAID 1, you'd require at least two drives, so you would require to buy one additional drive in most cases. With RAID 5 you'll require at least three drives, so two additional drives, and with RAID 6 or 10 you'd require at least four total drives. To earn additional implementation, redundancy, or disk space, you can count more disks to the collections as well.

To learn more about two types of RAID

https://brainly.com/question/19340038

#SPJ2

Write a program to implement problem statement below; provide the menu for input N and number of experiment M to calculate average time on M runs. randomly generated list. State your estimate on the BigO number of your algorithm/program logic. (we discussed in the class) Measure the performance of your program by given different N with randomly generated list with multiple experiment of Ns against time to draw the BigO graph (using excel) we discussed during the lecture.

Answers

Answer:

Explanation:

#include<iostream>

#include<ctime>

#include<bits/stdc++.h>

using namespace std;

double calculate(double arr[], int l)

{

double avg=0.0;

int x;

for(x=0;x<l;x++)

{

avg+=arr[x];

}

avg/=l;

return avg;

}

int biggest(int arr[], int n)

{

int x,idx,big=-1;

for(x=0;x<n;x++)

{

if(arr[x]>big)

{

big=arr[x];

idx=x;

}

}

return idx;

}

int main()

{

vector<pair<int,double> >result;

cout<<"Enter 1 for iteration\nEnter 2 for exit\n";

int choice;

cin>>choice;

while(choice!=2)

{

int n,m;

cout<<"Enter N"<<endl;

cin>>n;

cout<<"Enter M"<<endl;

cin>>m;

int c=m;

double running_time[c];

while(c>0)

{

int arr[n];

int x;

for(x=0;x<n;x++)

{

arr[x] = rand();

}

clock_t start = clock();

int pos = biggest(arr,n);

clock_t t_end = clock();

c--;

running_time[c] = 1000.0*(t_end-start)/CLOCKS_PER_SEC;

}

double avg_running_time = calculate(running_time,m);

result.push_back(make_pair(n,avg_running_time));

cout<<"Enter 1 for iteration\nEnter 2 for exit\n";

cin>>choice;

}

for(int x=0;x<result.size();x++)

{

cout<<result[x].first<<" "<<result[x].second<<endl;

}

}


Which statement describes Augmented Reality (AR) technology?

Answers

Answer:

Augmented Reality (AR) superimposes images and audio over the real world in real time. It does allow ambient light and does not require headsets all the time.

yan po ang szgot

wala po kasi pagpipilian

HOPE IT HELPS

pls follow ke

hello! can someone write a c++ program for this problem

Problema 2018.3.2 - Cheated dice
Costica is on vacation and his parents sent him to the country. There he gets terribly bored and looking through his grandfather's closet, he came across a bag full of dice. Having no one to play dice with, but it seemed to him that some of the dice were heavier than the others, Costica chose a dice and started to test it by throwing it with him and noting how many times each face fell. He then tries to figure out whether the dice are rolled or not, considering that the difference between the maximum number of appearances of one face and the minimum number of occurrences (of any other face) should not exceed 10% of the total number of throws.
Requirement
Given a number N of dice rolls and then N natural numbers in the range [1: 6] representing the numbers obtained on the rolls, determine whether the dice is tricked according to the above condition.
Input data
From the input (stdin stream) on the first line reads the natural number N, representing the number of rolls. On the following N lines there is a natural number in the range [1: 6] representing the numbers obtained on throws.
Output data
At the output (stdout stream) a single number will be displayed, 0 or 1, 0 if the dice are normal, and 1 if it is cheated.
ATTENTION to the requirement of the problem: the results must be displayed EXACTLY in the way indicated! In other words, nothing will be displayed on the standard output stream in addition to the problem requirement; as a result of the automatic evaluation, any additional character displayed, or a display different from the one indicated, will lead to an erroneous result and therefore to the qualification "Rejected".
Restrictions and clarifications
1. 10 ≤ N ≤ 100
2. Caution: Depending on the programming language chosen, the file containing the code must have one of the extensions .c, .cpp, .java, or .m. The web editor will not automatically add these extensions and their absence makes it impossible to compile the program!
3. Attention: The source file must be named by the candidate as: . where name is the last name of the candidate and the extension (ext) is the one chosen according to the previous point. Beware of Java language restrictions on class name and file name!
Input data

10
6
6
6
6
6
6
6
6
6
6
Output data
1

Roll the dice 10 times, all 10 rolls produce the number 6. Because the difference between the maximum number of rolls (10) and the minimum number of rolls (0) is strictly greater than 10% of the total number of rolls (10% of 10 is 1), we conclude that the dice are oiled.

Input data
10
1
4
2
5
4
6
2
1
3
3
Output data
0

Throw the dice 10 times and get: 1 twice, 2 twice, 3 twice, 4 twice, 5 and 6 at a time. Because the difference between the maximum number of appearances (two) and the minimum number of occurrences (one) is less than or equal to 10% of the total number of throws (10% of 10 is 1), we conclude that the dice are not deceived.

Answers

Answer:

f0ll0w me on insta gram Id:Anshi threddy_06 (no gap between I and t)

With the addition of electric cars, we have a need to create a subclass of our Car class. In this exercise, we are going to create the Electric Car subclass so that we can override the miles per gallon calculation since electric cars don’t use gallons of gas.
The Car class is complete, but you need to complete the ElectricCar class as outlined in the starter code with comments.
Once complete, use the CarTester to create both a Car and ElectricCar object and test these per the instructions in the CarTester class.
Classes
public class CarTester
{
public static void main(String[] args)
{
// Create a Car object
// Print out the model
// Print out the MPG
// Print the object
// Create an ElectricCar object
// Print out the model
// Print out the MPG
// Print the object
}
}
////////////////////////////
public class ElectricCar extends Car {
// Complete the constructor
public ElectricCar(String model){
}
// Override the getMPG here.
// It should return: "Electric cars do not calculate MPG.
// Override the toString() here.
// (model) is an electric car.
}
//////////////////////////////////
public class Car {
//This code is complete
private String model;
private String mpg;
public Car(String model, String mpg){
this.model = model;
this.mpg = mpg;
}
public String getModel(){
return model;
}
public String getMPG(){
return mpg;
}
public String toString(){
return model + " gets " + mpg + " mpg.";
}
}

Answers


Hey will you please help me with my essay and I’ll get back to yours please ASAP//

8. (a) Write the following statements in ASCII
A = 4.5 x B
X = 75/Y

Answers

Answer:

Explanation:

A=4.5*B

65=4.5*66

65=297

1000001=11011001

10000011=110110011(after adding even parity bit)

X=75/Y

89=75/90

10011001=1001011/1011010

100110011=10010111/10110101(after adding even parity bit)

A network consists of 75 workstations and three servers. The workstations are currently connected to the network with 100 Mbps switches, and the servers have 1000 Mbps connections. Describe two network problems that can be solved by replacing the workstations' 100 Mbps switches and NICs with 1000 Mbps switches and NICs. What potential problems can this upgrade cause

Answers

Answer:

A)  i) starvation  ii) flow control

B) Network congestion

Explanation:

A) Network problems that can be addressed / solved

By replacing the workstations 100 Mbps switches with 1000 Mbps switches the problem of

Starvation;  been faced by the servers due to the delay in sending data to be processed by the servers from the workstations will be resolved .

Flow control : The huge difference in the speeds of the workstations and servers causes a network buffer which leads to packet loss therefore when the workstations 100 Mbps switch is replaced with 1000 Mbps switch this network problem will be resolved

b) The potential problem that can be encountered is Network Congestion

Given a member function named set_age() with a parameter named age in a class named Employee, what code would you use within the function to set the value of the corresponding data member if the data member has the same name as the parameter

Answers

Answer:

Explanation:

This would be considered a setter method. In most languages the parameter of the setter method is the same as the variable that we are passing the value to. Therefore, within the function you need to call the instance variable and make it equal to the parameter being passed. It seems that from the function name this is being written in python. Therefore, the following python code will show you an example of the Employee class and the set_age() method.

class Employee:

   age = 0

   

   def __init__(self):

       pass

   

   def set_age(self, age):

       self.age = age

As you can see in the above code the instance age variable is targeted using the self keyword in Python and is passed the parameter age to the instance variable.        

Why do organizations need to tailor project management concepts, such as those found in the PMBOK® Guide, to create their own methodologies?

Answers

Explanation:

Although each project is different and unique, according to the Method Statement of PMBoK, customising is required. Not that every procedure, tool, methodology, input, or output listed in the PMBoK Guide is mandated for every project. Scope, timeline, cost, materials, quality, and danger should all be considered while tailoring.

What does the top-level domain in a URL indicate?
A. the organization or company that owns the website
B. the organization or company that operates the website
C. the protocol used to access the website D. the type of website the URL points to

Answers

Answer:

b i think

Explanation:

A top-level domain (TLD) is the last segment of the domain name. The TLD is the letters immediately following the final dot in an Internet address. A TLD identifies something about the website associated with it, such as its purpose, the organization that owns it or the geographical area where it originates.

Answer:

The answer is D. The type of website the URL points to.

Explanation:

I got it right on the Edmentum test.

Which of the following is true? a. There are RFCs that describe challenge-response authentication techniques to use with email. b. Filtering for spam sometimes produces a false positive, in which legitimate email is identified as spam. c. Spam relies heavily on the absence of email authentication. d. All of the above.

Answers

The option that is true is option b. Filtering for spam sometimes produces a false positive, in which legitimate email is identified as spam.

How is spam filtration carried out?

The processing of email to organize it in accordance with predetermined criteria is known as email filtering. The word can allude to the use of human intelligence, although it most frequently describes how messages are processed automatically at SMTP servers, sometimes using anti-spam tactics.

Therefore, Email filtering operates as previously stated by scanning incoming messages for red flags that indicate spam or phishing content and then automatically transferring such messages to a different folder. Spam filters evaluate an incoming email using a variety of criteria.

Learn more about Filtering for spam from

https://brainly.com/question/13058726
#SPJ1

You work for a large company that has over 1000 computers. Each of these computes uses a wireless mouse and keyboard. Therefore, your company goes through a lot of alkaline batteries. When these batteries can no longer power the intended device, you must decide what to do with them. Unless otherwise dictated by your local authorities, which of the following would be the EASIEST way to deal with these batteries?
They must be sent to hazardous waste collection

a. They can be recharged.
b. They must be stored onsite until they expire
c. They can be thrown in the trash.

Answers

The answer to this question is, "They can be thrown in the trash."

Explanation: This is because it specifies how to get rid of them UNLESS local authorities have told you otherwise.

Write a function called csv_sum that takes a filename and returns the sum of all of the numbers in the file. The numbers are in csv format. For instance, if the contents of the file are: 12,3,2 -5 10,20,-10,8.3 Then the function should return 40.3.

Answers

Answer:

Explanation:

def csv_sum(filename):

   total = 0

   try:

       f = open(filename)

       for line in f:

           words = line.strip().split(",")

           for word in words:

               total += float(word)

       f.close()

   except FileNotFoundError:

       pass

   return total

list and describe each of the activities of technology

Answers

Answer:

network has led to exposure of dirty things to young ones.

air transport has led to losing of lives

Other Questions
(1 point) Find if =1,0,1 and =4,5,2 Is the angle between the vectors "acute", "obtuse" or "right"? Do you think the Corona virus was from bats or do you think it was created in a lab? write 3 sentences about your opinion. Pascal system . write the program that will calculate the perimeter of a rectangle if its area is A (m) and one of its sides has a length of B (m). A and B are entered from the keyboard. You are touring several ecosystems, including an icy coastline in the Arctic, and a dry desert in the southwest United States. Do you predict that you will observe equal numbers of ectotherms and endotherms in all ecosystems? Explain your prediction. f(x) = 2(x+4)2 - 6Vertex:Is the vertex a max or min? Why do you think evolution is important? HURRY PLEASE SORRY FOR RUSHING YOU, BUT I WANT TO PASS Refer to OP for Exercises 1-8. If SN and MT are diameters with m/ SPT 51 and m/ NPR 29, determine whether each arc is a minor arc, a major arc, or a semicircle. Then find the degree measure of each arc.1. MNR3. mTSR2. MST4. mMSTIf MT= 15, find the length of each arc. Round to the nearest tenth.5. NR7. TSR6. ST8. MSTMNRGeometry Drag the tiles to the correct boxes to complete the pairs.Simplify the mathematical expressions to determine the product or quotient in scientific notation. Round so the first factor goes to the hundredths place. HELP ME PLEASE WHAT IS What is 2/5 divided by 3/4 IT CAN NOT BE A DECIMAL Astronomers have measured that there is more helium in the universe than can be explained by the fusion in stars over the last 13 billion years. How do they think the extra helium got into the universe Which revision is needed to correct the following sentence?Weatherby would not allow the scouts into the building nor, would hecall Mr. Slate down to see them.A. Move the comma to after the word buildingB. Add a comma after the word scouts.C. Move the comma to after the word notD. Add a comma after the word Slate. Which of the following do rain forests produce?oxygengrasslandscarbon monoxidepopular medicines HURRY PLEASE HELP!! Read this excerpt from Percy Shelley's "To a Skylark." Which THREE lines contain a simile?Hail to thee, blithe Spirit!Bird thou never wert,That from Heaven, or near it,Pourest thy full heartIn profuse strains of unpremeditated art.Higher still and higherFrom the earth thou springestLike a cloud of fire;The blue deep thou wingest,And singing still dost soar, and soaring ever singest.In the golden lightningOf the sunken sun,O'er which clouds are bright'ning,Thou dost float and run; The diameter of a circle is 8 cm. Find its circumference in terms of \pi. what is the difference between quantity demand and quantity supply. The weather associated with a Low can be significantly different than that of a High. The differing vertical motions account for some of these differences. Vertical motions lead to temperature changes in the rising or sinking air. The temperature changes occur because air warms when it is compressed and cools when it expands. In the open atmosphere, air pressure is less at increasing altitudes. Consequently, air expands and cools when ___________. Air is compressed and warms when ___________.A. ascending, descendingB. descending, ascendingC. ascending, ascendingD. descending, descending A math teacher noticed that 70% of seventh graders completed an extra credit assignment. About how many of 130 seventh graders would complete the extra credit assignment? plz help its due today I need 5 paragraphs as soon as possible please