Question Details

(Solved by Expert Tutors)

26.Assume that this program compiles and runs. Assume that the use


26.Assume that this program compiles and runs. Assume that the user enters 5 six (separated by a space) for input. What is the output? As always, be precise when showing your output.

import java.util.Scanner;

public class TryCatchQuestion

{

public static void main(String [] args)

{

Scanner stdIn = new Scanner(System.in);

System.out.println("Please enter 2 numbers seperated by a space");

try

{

System.out.println("Output: " + stdIn.nextInt() / stdIn.nextInt());

}

catch (NumberFormatException e)

{

System.out.println("Number Format Exception");

}

catch (ArithmeticException e)

{

System.out.println("Division by zero");

}

catch (Exception e)

{

System.out.println("Other Exception");

}

}//end main

}//end TryCatchQuestion

25.

Assume that this program compiles and runs. Assume that the user enters 5 0 (separated by a space) for input. What is the output? As always, be precise when showing your output.

import java.util.Scanner;

public class TryCatchQuestion

{

public static void main(String [] args)

{

Scanner stdIn = new Scanner(System.in);

System.out.println("Please enter 2 numbers seperated by a space");

try

{

System.out.println("Output: " + stdIn.nextInt() / stdIn.nextInt());

}

catch (NumberFormatException e)

{

System.out.println("Number Format Exception");

}

catch (ArithmeticException e)

{

System.out.println("Division by zero");

}

catch (Exception e)

{

System.out.println("Other Exception");

}

}//end main

}//end TryCatchQuestion

24.

Assume that this program compiles and runs. Assume that the user enters 5 6 (separated by a space) for input. What is the output? As always, be precise when showing your output.

import java.util.Scanner;

public class TryCatchQuestion

{

public static void main(String [] args)

{

Scanner stdIn = new Scanner(System.in);

System.out.println("Please enter 2 numbers seperated by a space");

try

{

System.out.println("Output: " + stdIn.nextInt() / stdIn.nextInt());

}

catch (NumberFormatException e)

{

System.out.println("Number Format Exception");

}

catch (ArithmeticException e)

{

System.out.println("Division by zero");

}

catch (Exception e)

{

System.out.println("Other Exception");

}

}//end main

}//end TryCatchQuestion

23.

Assume that this code fragment compiles and runs. What is its output? As always, be precise when showing your output.

public static void main(String [] args)

{

int x = 3;

int xf = 0;

if (x == 0 || x == 1)

{

xf = 1;

}

else

{

xf = 1;

for (int ; i<; i++)

{

xf *= i;

}

}

System.out.println("Results are: " + xf);

}

22.

Given the following array declaration, what statement would print out Blueberry ? 3.14 to the screen?

double [] myNumbers = new double[]{1.23, 3.14, 5.18, 82, 2.56};

String [] myPi = new String[]{"Strawberry", "Lemon", "Blueberry", "Apple", "Pumpkin"};

System.out.println(System.out.println(myPi[3] + " - " + myNumbers[2]););

System.out.println(System.out.println(myPi[3] & " - " & myNumbers[2]););

System.out.println(System.out.println(myPi[2] & " - " & myNumbers[1]););

System.out.println(System.out.println(myPi[2] + " - " + myNumbers[1]););

19. Add the variable called input to the ArrayList declared below.

private static ArrayList<Integer> floors = new ArrayList<>();

18.

Write the statement to access the 8th element of the array defined below?

Integer [] priceList = new Integer [10];

17. The getSource method is used to determine the component causing the event that was fired from inside an actionPerformed method.

True

False

16. When using parseInt() to convert a String to a number, a non-integer value causes a runtime error.

True

False

 


Solution details:

Pay using PayPal (No PayPal account Required) or your credit card . All your purchases are securely protected by .
SiteLock

About this Question

STATUS

Answered

QUALITY

Approved

DATE ANSWERED

Apr 19, 2020

EXPERT

Tutor

ANSWER RATING

YES, THIS IS LEGAL

We have top-notch tutors who can do your essay/homework for you at a reasonable cost and then you can simply use that essay as a template to build your own arguments.

You can also use these solutions:

  • As a reference for in-depth understanding of the subject.
  • As a source of ideas / reasoning for your own research (if properly referenced)
  • For editing and paraphrasing (check your institution's definition of plagiarism and recommended paraphrase).
This we believe is a better way of understanding a problem and makes use of the efficiency of time of the student.

NEW ASSIGNMENT HELP?

Order New Solution. Quick Turnaround

Click on the button below in order to Order for a New, Original and High-Quality Essay Solutions. New orders are original solutions and precise to your writing instruction requirements. Place a New Order using the button below.

WE GUARANTEE, THAT YOUR PAPER WILL BE WRITTEN FROM SCRATCH AND WITHIN A DEADLINE.

Order Now