Reference no: EM133056218
For this project, you will write a Java program that demonstrates exception handling. To facilitate this, you will need to collect input from a user, perform calculations, and send output to the screen. Exception handling will catch any input and calculation errors that may arise. For this project you will need the following variables (all integers): Three to store the input from the user, one to store the sum, and one to store the total. Remember to set their initial values to zero.
Create a new Java project. Write code to prompt the user to enter a number, then repeat this for a second number and a third. As each number is entered, store it in a variable. In each case, use an Input Mismatch Exception handler to catch when the user enters a letter instead of a number. Use the Catch block to inform the user that they should only enter numbers.
When all three numbers have been stored in variables, add the three numbers (their variables) together and store the sum in another variable.
Next, calculate a total that equals the sum of the three variables divided by the third input variable. (Put another way, divide the sum of the numbers by the third number that the user entered.) Use an Arithmetic Exception to handle situations where the third number that was entered by the user was a zero, informing the user that the program has produced a "Divide by zero error."
Document your code thoroughly with code comments and be sure to explain how each exception works and what it is doing.
Find the maclaurin series
: Find the Maclaurin series up to and including the term - Let w be one of the non-real solutions of the equation
|
What is the present value
: Question - Assuming the interest rate is 4%, what is the present value of a $1,800 payment you will receive in 4 years, 6 years, 10 years
|
Monitor security risks across the enterprise
: Describe at least 2 identity and access management tools needed to measure and monitor security risks across the enterprise.
|
Determine the correct amount of net income
: Accrued expenses of $11,500 were omitted at the end of 1996. Determine the correct amount of net income for 1995 and 1996
|
Java program that demonstrates exception handling
: Write a Java program that demonstrates exception handling. calculate a total that equals the sum of the three variables divided by the third input variable.
|
Are index funds more risky
: Are index funds (ETFs) more risky? What is the difference between market risk and active risk?
|
What is the number of issued and outstanding ordinary shares
: Monggo Company reported the following equity accounts: Preference share capital, par value P15 2,550,000, What is the number of issued and outstanding ordinary
|
What is the external financing needed
: The most recent financial statements for incredible edibles, Inc are shown here ( assuming no income taxes):
|
What is the value of firm
: Leisure Vacations is an unlevered firm with aftertax net income of $57,980, a cost of capital of 13.2 percent, and a tax rate of 35 percent.
|