Create a program in Java with the following requirements:
Example of a result:
enter the first number: 2
enter the second number: 8
enter the third number: 6
sum is 16
product is 96
Lucky Duck!
largest is 8
`Hey,
Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.
import java.util.Scanner;
public class Test{
public static void main(String []args){
Scanner sc=new Scanner(System.in);
int a,b,c;
System.out.println("enter the first number: ");
a=sc.nextInt();
System.out.println("enter the second number: ");
b=sc.nextInt();
System.out.println("enter the third number: ");
c=sc.nextInt();
int sum=a+b+c;
int prod=a*b*c;
int large=a;
if(b>=a&&b>=c)
{
large=b;
}
if(c>=a&&c>=b)
{
large=c;
}
System.out.println("sum is "+sum);
System.out.println("product is "+prod);
if(a%2==0&&b%2==0&&c%2==0)
{
System.out.println("Lucky Duck!");
}
if(a%2==1&&b%2==1&&c%2==1)
{
System.out.println("How Odd!");
}
System.out.println("largest is "+large);
}
}

Kindly revert for any queries
Thanks.
Create a program in Java with the following requirements: Using a Scanner and print statements, ask...
Java Submit a program in a .java file. The program should print a multiplication table for the numbers 1-9. This requires a nested for loop. The outer loop moves from row to row, while the inner loop prints the row. Use tabs to separate the output, such as in the following statement: System.out.println(“1\t2\t3\t4\t5\t6\t7\t8\t9”); Output should look similar to the following. 1 2 3 4 5 6 7 8 9 ------------------------------------------------------------------ 1 2 3 4 5 6 7 8 9...
Use a java program that does the following:
. (10 points) Write a program as follows a. Prompt the user to input two positive integers: nl and n2 (nl should be less than n2) b. If the user enters the negative number(s), convert it/them to positive number(s) c. If nl is greater than n2, swap them. d. Use a while loop to output all the even numbers between nl and n2 e. Use a while loop to output the sum...
write a program in java to print all the powers of 2 below a certain number and calculate their sum. Make sure your program conforms to the following requirements. 1. Accept the upper limit from the user (as an integer). 2. These numbers grow very fast. make sure the sum variable is of the "long" type. You can assume that the test output will be less that LONG MAX. 3.Print all numbers as a running sum, and finally print their...
this assignment need to be done in java only Requirements: Ask the user to enter the size of an array (int value) Allocate a 2D array of int that size (if the user enters in 5, then allocate a 5x5 array) Using a Random, initialize each element of the array to be either 0 or 1 Output the array in a table format (see below for an example) Output the fraction of your array that is ones and the fraction...
Need a program in java that creates a random addition math quiz The program should ask the user to enter the following The smallest and largest positive numbers to be used when generating the questions - The total number of questions to be generated per quiz - The total number of the quiz's to create
Write a Java program that: • Asks the user to enter the number of integers that he need to enter; • Asked him to enter integer by integer; • Print The number of Odd numbers entered and the number of Even numbers entered. Important notes: 1. You should have to copy and paste the Java as your answer for this question. DON’T take screen shot for your Java Code. It must be editable. 2. Take a screen shot for your...
Create two java programs. The first will ask the user to enter three integers. Once the three integers are entered, ask the user to enter one of three functions. The “average” if they want the average of the three numbers entered, enter “min” if they want the minimum and “max” if they want the maximum. Display the answer. Ask the user if they want to calculate another function for the three numbers. If so, loop and ask what function they...
Need a program in java that creates a random addition math quiz The program should ask the user to enter the following The smallest and largest positive numbers to be used when generating the questions - The total number of questions to be generated per quiz - The total number of the quiz's to create from then the program should generate a random math (Just addition) quiz from what the user entered
(Java) HELP! Create a program that will ask the user to enter their first name and their favorite number. Ask the user if they would like the information repeated back to them. If they type "Y" display the answers back to them. If they type anything else, display the word "Goodbye". An example of what your output window should look like is below. The system-generated output is in red. The user-provided input is in green. (Your actual program will only...
Write a java program to print all the powers of 2 below a certain number and calculate their sum Requirements: 1. Accept the upper limit from the user as an integer 2. Make sure the sum variable is of the “long” type. You can assume that the test output will be less than LONG MAX. 3. Print all the numbers as a running sum, and finally print their sum. Please try and restrict yourself to loops, selection statements, and calls...