Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help and please satisfy the directions. The directions are under program 3. port JavaScore. public class Example 4 [ public static int getint String

Please help and please satisfy the directions. The directions are under program 3.
image text in transcribed
port JavaScore. public class Example 4 [ public static int getint String strum - JOptionPane.showinput Dialog("Enter an integer"); return integer.parseInt(strum): public static void main(String args Scanner input = new Scanner (System.in): System.out.println("Enter 2 integers"); intx input.nextInt(); inty input.nextInt(): 1/ these are simple is if b ) System.out.println("The first number is positive): if (0 y0) System.out.println("Both numbers are positive"); ( 11 y) System.out.println("At least one number is positive"); of Do ) System.out.println("The first number is positive: else System.out.println("The first number is not positive": If x y ) System.out.println("At least one number is positive"); else System.out.printf(Both numbers are negative: Product 3d", xyl: I now we use the method x-getinte y - getinti: if (x0) if (y) System.out.println("Both are positive"); else System.out.println("First number is positive, Second not positive": else System.out.println("First not positive, Second don't know); If you have more than one statement in an if you must use braces. if (xc0){ System.out.println("First number not positive"): X = - X; // make x not negative The braces indicate that you want both statements executed as part of the if. Some books call this a block or compound statement. Either way, the braces are required when there is more than one statement. Program 3 Using Eclipse, write a program that first asks the user to enter three real numbers using GUI input. Print the sum if all three numbers are positive, print the product of the two positive numbers if only one is negative - use one nested if. Then, ask the user to enter two real numbers from the console. If both numbers are negative, print the quotient. All output should be to a dialog and the console. console output must be done using printf and format specifiers. Use meaningful variable names, informative prompts and label your output. Write a method getFloat to al numbers. This should be similar to the method getint above. Good program structure, indentation, a heading and comments are required. Points will be deducted for any program not meeting the requirements

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

1-4 How will MIS help my career?

Answered: 1 week ago