Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Using Java. Using Eclipse, write a program that first asks the user to enter thr

ID: 3785846 • Letter: U

Question

Using Java. 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 done using printf and format specifiers. Use meaningful vaiable names, infomative prompts and label output. Write a method getFloat to ask for the real numbers. Good program structure, indentation, a heading and comments are required.

Explanation / Answer

import java.util.Scanner; // exercise 2.17 public class ArithmeticSmallestLargest { public static void main(String[] args) { Scanner input = new Scanner(System.in); int num1; int num2; int num3; int sum; int average; int product; int largest; int smallest; System.out.print("Enter First Integer: "); num1 = input.nextInt(); System.out.print("Enter Second Integer: "); num2 = input.nextInt(); System.out.print("Enter Third Integer: "); num3 = input.nextInt(); sum = num1 + num2 + num3; average = sum / 3; product = num1 * num2 * num3; largest = num1; smallest = num1; if(num2 > largest) largest = num2; if(num3 > largest) largest = num3; if(num2
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote