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
Eduardwww [97]
3 years ago
14

The Double.parseDouble() method requires a String argument, but it fails if the String cannot be converted to a floating-point n

umber. Write an application in which you try accepting a double input from a user and catch a NumberFormatException if one is thrown. Te catch block forces the number to 0 and displays an appropriate error message. Following the catch block, display the number. Save the fle as TryToParseDouble.java.
Engineering
1 answer:
LuckyWell [14K]3 years ago
5 0

Answer:

  1. import java.util.Scanner;
  2. public class TryToParseDouble {
  3.    public static void main(String[] args) {
  4.        Scanner input = new Scanner(System.in);
  5.        double num;
  6.        try{
  7.            System.out.print("Input a number: ");
  8.            num = Double.parseDouble(input.nextLine());
  9.        }catch(NumberFormatException e){
  10.            num = 0;
  11.            System.out.println("Invalid input! It should be a number in double type");
  12.        }
  13.        System.out.println(num);
  14.    }
  15. }

Explanation:

Firstly, create a Scanner object to get user input (Line 5).

Next, create a try block and prompt user to input a number and use Double.parseDouble() method to convert the input to double type in the block (Line 8-10).

Next, create a catch block to catch a NumberFormatException. In the Catch block, set the num to zero and then print out a message to inform user about the invalid input (Line 12-14).

Lastly, display the number (Line 16).

You might be interested in
By using order of magnitude analysis, the continuity and Navier-Stokes equations can be simplified to the Prandtl boundary-layer
Mademuasel [1]

Answer: Attached below is the well written question and solution

answer:

i) Attached below

ii) similar parameter =  \frac{V}{VoL } = 1 / Re

Explanation:

Using ;  L as characteristic length and Vo as reference velocity

i) Nondimensionalize the equations

ii) Identifying similarity parameters

the similar parameters are  = \frac{V}{VoL } = 1 / Re

Attached below is the detailed solution

7 0
3 years ago
SSL/TLS is used for ________.
Nana76 [90]

Answer:

1.Originally developed by Netscape, SSL is an Internet security protocol used by Internet browsers and Web servers to transmit sensitive information. SSL has become part of an overall security protocol known as Transport Layer Security (TLS). SSL/TLS can be used for Web applications

2.Small malware programs that download larger malware programs are called downloaders

3. Single network addresses in different single networks are neither unique nor unique if the two single networks use the same technology standards

4. Converting application messages into bits is called encoding

5. Guarantees by a provider to meet certain delivery quality specifications are called service level agreements

6. Advanced persistent threats are particularly dangerous for enterprises, as hackers have ongoing access to sensitive company data. They are extremely dangerous for the victim

7. In antivirus filtering, the best ways to filter currently use BEHAVIOURAL DETECTION

8. The general name for malware on a user's PC that collects sensitive information and sends this information to an attacker is SPYWARE

9. Firewall log files should be read EVERYDAY

10. When a firewall identifies an attack packet, it both discards the packet and copies information about the packet into a log file

11. IT security employees are the most difficult employees

12. In authentication, the SUPPLICANT is the party trying to prove his or her identity.

13. In a firewall, VPN traversal reduces firewall filtering effectiveness

14. DIRECTLY-PROPAGATING WORM can spread more rapidly

15 UDP is an unreliable, connectionless transport layer protocol that provides message-based data transmission. TCP is an example of connection-oriented protocols.

16. Host P transmits a SYN segment to Host Q. If host Q is willing to open the connection, it will transmit a SYN/ACK segment.

17. 802.11 data link layer standards govern neither access point operation nor frame organization

18. Credit card number thieves are called CARDERS

19. Using encryption, you make it impossible for attackers to read your messages even if they intercept them. This is CONFIDENTIALITY

20. Iris scanning is attractive because of its PRECISION

21. The source socket is 60.171.18.22:57707. The source is a CLIENT

4 0
4 years ago
What is the first thing to do when you make a three-point turn?.
Jlenok [28]

Answer:

1. Move as far right as possible, check traffic, and signal a left turn.

2. Turn the steering wheel sharply to the left and move forward slowly.

3. Shift to reverse, turn your wheels sharply to the right, check traffic, and back your vehicle to the right curb, or edge of roadway.

5 0
3 years ago
Think for a moment about the potential problems with big data that the speaker mentioned:
Natalka [10]

Answer: 1. sadly yes, some people are treated unfairly for crimes people yet have commited. 2. no 3. yes

Explanation:

i did this last year

5 0
3 years ago
Read 2 more answers
Beryllium (Be) has an HCP unit cell for which the ratio of the lattice parameters c/a is 1.568. If the radius of the Be atom is
sweet-ann [11.9K]

Answer:

Unit cell volume will be

4.866*10^{-2}nm^{3}

8 0
3 years ago
Other questions:
  • A hole drilled into a manufactured part is specified to have a diameter of 1.50 cm. Ten parts are sampled from a production run.
    10·1 answer
  • Air enters a compressor operating at steady state at 1.05 bar, 300 K, with a volumetric flow rate of 39 m3/min and exits at 12 b
    6·1 answer
  • Chemical engineering got is unofficial start around the time of the __________ __________ ________.
    13·1 answer
  • Ame:<br> 7. A step-down transformer reduces the primary current.<br> True or false
    8·2 answers
  • Mr. Blue lives in a blue house, Mrs. Pink lives in a pink house and Mr. Red lives in a red house. Who lives in the White House?
    11·1 answer
  • Madison how do you do this
    10·2 answers
  • 3 mA are flowing through an 18 V circuit, how much resistance (in kΩ) is in that circuit?
    13·1 answer
  • What kinds of problems or projects would a mechanical engineer work on?
    11·1 answer
  • An air-standard Diesel cycle engine operates as follows: The temperatures at the beginning and end of the compression stroke are
    12·1 answer
  • There are four people who want to cross a rickety bridge; they all begin on the same side. You have 17 minutes to get them all a
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!