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
Temka [501]
4 years ago
7

Write a custom exception class called ParameterNotAllowedException that contains the following: 1. An integer instance variable

representing the input number that went wrong. 2. A two parameter constructor that accepts a message and an integer, This constructor should copy the integer parameter into the instance variable and call the Exception class's one parameter constructor. 3. An overidden getMessage() method that returns a message explaining that the integer is invalid.
Computers and Technology
1 answer:
jeyben [28]4 years ago
7 0

Answer:

See explaination

Explanation:

//class extends Exception

class ParameterNotAllowedException extends Exception {

//Instance variable

private int input;

//Argumented constructor

public ParameterNotAllowedException(String message, int input) {

super(message);

this.input = input;

}

public int getInput() {

return input;

}

public void setInput(int input) {

this.input = input;

}

atOverride // Replace the "at" with at symbol ie shift 2

public String getMessage() {

//Returns the message

return input+" is invalid. "+super.getMessage();

}

}

class Main {

public static void main(String[] args) throws ParameterNotAllowedException {

int n = -1;

//Throw negative not allowed exception

if(n<0){

throw new ParameterNotAllowedException("negative number",n);

}

}

}

You might be interested in
Ssume that the timeout values for all three protocols
prisoha [69]

Answer:

The explanation of the question is described in the section below.

Explanation:

(a)

Go Back N :

A gives in a maximum of 9 pieces. Typically they will be sent back sections 1, 2, 3, 4, 5 and then re-sent segments 2, 3, 4 and 5.

B sends out 8 ACK's. They are 4 ACKS including 1 series and 4 ACKS with 2, 3, 4 and 5 series amounts.

Selective Repeat :

A sends in such max of 6 bits. Subsequently, segments 1, 2, 3, 4, 5 and earlier re-sent Segments 2 will be sent.

B assigns five ACKs. We are 4our ACKS with numbers 1, 3, 4, 5. However there is one sequence quantity 2 ACK.

TCP :

A assigns in a total of 6 bits. Originally, segments 1, 2, 3, 4, 5 and future re-sent Segments 2 have always been sent.

B sends five ACKs. There are 4 ACKS with either the number 2 series. There has been one ACK with a sequence of numbers 6. Remember that TCP always needs to send an ACK with a sequence number you anticipate.

(b)

This is although TCP utilizes convenient retransmission without searching for the time out.

So, it's the right answer.

4 0
3 years ago
The term that refers to the standard computer language for creating web pages is called:
Pavel [41]

Answer:

Language programming Web's programming language

Explanation:

6 0
4 years ago
Based on the module,
svp [43]

Answer:

Explanation:

One group of students did an experiment to study the movement of ocean water. The steps of the experiment are listed below.

Fill a rectangular baking glass dish with water.

Place a plastic bag with ice in the water near the left edge of the dish.

Place a lighted lamp near the left edge of the dish so that its light falls directly on the plastic bag.

Put a few drops of ink in the water.

The student did not observe any circulation of ink in the water as expected because the experiment had a flaw. Which of these statements best describes the flaw in the experiment? (2 points)

Not enough ink was added.

Not enough water was taken.

The dish was too small for the experiment.

The lamp and the ice bag were at the same place.

8 0
3 years ago
Write a function called order() thattakes three parameters, and rearranges the integers referred to sothat the largest is first,
gogolik [260]

Answer: The c++ program to implement order() method is given below.

#include <iostream>

using namespace std;

void order(int a, int b, int c);

int main() {

   int x, y, z;

   cout<<"This program displays numbers in descending order."<<endl;

   do

   {

       cout<<"Enter first number"<<endl;

       cin>>x;

       if(x<0)

           cout<<"Invalid input. Enter a positive number."<<endl;

   }while(x<0);

   do

   {

       cout<<"Enter second number"<<endl;

       cin>>y;

       if(y<0)

           cout<<"Invalid input. Enter a positive number."<<endl;

   }while(y<0);

   do

   {

       cout<<"Enter third number"<<endl;

       cin>>z;

       if(z<0)

           cout<<"Invalid input. Enter a positive number."<<endl;

   }while(z<0);

   order(x, y, z);

   return 0;

}

void order(int a, int b, int c)

{

   if((a>b)&&(a>c))

   {  

       cout<<"Numbers in decreasing order are"<<endl;

       cout<<a<<endl;

           if(b>c)

           {

               cout<<b<<endl;        

               cout<<c<<endl;

           }

           else

           {

               cout<<c<<endl;

               cout<<b<<endl;

           }

   }    

   if((b>a)&&(b>c))

   {  

       cout<<"Numbers in decresing order are"<<endl;

       cout<<b<<endl;

           if(a>c)

           {

               cout<<a<<endl;        

               cout<<c<<endl;

           }

           else

           {

               cout<<c<<endl;

               cout<<a<<endl;

           }

   }    

   if((c>b)&&(c>a))

   {  

       cout<<"Numbers in decreasing order are"<<endl;

       cout<<c<<endl;

           if(a>b)

           {

               cout<<a<<endl;        

               cout<<b<<endl;

           }

           else

           {

               cout<<b<<endl;

               cout<<a<<endl;

           }

   }

       

}

OUTPUT

This program displays numbers in descending order.

Enter first number

12

Enter second number

-9

Invalid input. Enter a positive number.

Enter second number

0

Enter third number

55

Numbers in decreasing order are

55

12

0

Explanation:

The method order() is declared as follows.

void order(int a, int b, int c);

The method is declared void since it does not return any value.

This program is designed to accept 0 and positive integers only. This is implemented by do-while loop while taking user input.

The program uses 3 integer variables to store the user input.

int x, y, z;

The method order() is designed to accept 3 integer parameters. This method is called once user enters valid input.

order(x, y, z);

These numbers are compared in order to display them in descending order.

No variable is used for comparison. The method simply compares the numbers and displays them using multiple if-else statements.

4 0
3 years ago
Which area of the network would a college IT staff most likely have to redesign as a direct result of many students bringing the
zvonat [6]

Answer:

wireless LAN

Explanation:

An extranet is a network area where people or corporate partners external to the company access data. An intranet simply describes the network area that is normally accessed only by internal personnel. The wired LAN is affected by BYODs (bring your own devices) when the devices attach to the wired network. A college wireless LAN is most likely used by the tablet and smartphone. A wireless WAN would more likely be used by college students to access their cell provider network.

3 0
4 years ago
Other questions:
  • The support group at Universal Containers wants agents to capture different information for product support and inquiry cases. I
    14·1 answer
  • Select the correct answer.
    12·2 answers
  • In what year was google launched on the web?
    14·1 answer
  • How to solve 3(x - 2) = 9x<br><img src="https://tex.z-dn.net/?f=3%28x%20-%202%29%20%3D%209x" id="TexFormula1" title="3(x - 2) =
    14·1 answer
  • Where is a 3D modeler most likely to work?
    6·1 answer
  • Whats the best way to get into a computers programming to get past firewalls
    15·2 answers
  • You've run 200 ft of cable and lost 7dB. What is the loss rate of your cable per 100 ft?
    14·1 answer
  • Write the code for the following problem.
    9·1 answer
  • All banks follow the same guideline for determining if an applicant qualifies for a loan.
    13·1 answer
  • The key uniquely identifies each record
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!