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 want, otherwise terminate the program.
The calculation of the answer must be done by a method that is in the second program.
The second java program will have a constructor, three instance variables of type integer and three methods. The constructor will require three integers that will place them in their corresponding instance variables.
The methods will be called average, minimum and maximum. They will all require no arguments and will return an int.
The average method will use the three instance variables as input and calculate the average of all three and return the average as an integer.
The maximum method will use the three instance variables as input and calculate the maximum of all three and return the maximum as an integer.
The minimum method will use the three instance variables as input and calculate the minimum of all three and return the minimum as an integer.
*******PROGRAM
1********
import java.util.Scanner;
public class Program_1 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
//Take three numbers as input
System.out.println("Enter the First Number");
int num1 = sc.nextInt();
System.out.println("Enter the Second Number");
int num2 = sc.nextInt();
System.out.println("Enter the Third Number");
int num3 = sc.nextInt();
Program_2 calculate = new Program_2(num1, num2, num3);
int z ;
do {
//Asking the user to enter one of three functions.
System.out.println("Enter one of the three
functionality");
String function = sc.next();
switch (function) {
case "average":
int avg=calculate.average();
System.out.println("Average of the three number is :"+avg+"
");
break;
case "min":
int min=calculate.mininum();
System.out.println("Minimum of the three number is
:"+min+"");
break;
case "max":
int max=calculate.maximum();
System.out.println("Maximum of the three number is
:"+max+"");
break;
}
System.out.println("Do you want to continue ?");
String check = sc.next();
if (check.equals("yes")) {
z = 1;
} else {
z = 0;
}
} while (z != 0);
}
}
*******PROGRAM 2********
class Program_2 {
int num_1;
int num_2;
int num_3;
Program_2(int num1, int num2, int num3) {
this.num_1 = num1;
this.num_2 = num2;
this.num_3 = num3;
}
//function to find
average
int average() {
int result = (num_1 + num_2 + num_3) / 3;
return result;
}
//function to find maximum
int maximum() {
int result = num_1;
if (num_2 > result) {
result = num_2;
}
if (num_3 > result) {
result = num_3;
}
return result;
}
//function to find
minimum
int mininum() {
int result = num_1;
if (num_2 < result) {
result = num_2;
}
if (num_3 < result) {
result = num_3;
}
return result;
}
}
*****OUTPUT FOR THE GIVEN CODE*****

run: Enter the First Number 4. Enter the Second Number Enter the Third Number Enter one of the three functionality average Average of the three number is : 6 Do you want to continue ? yes Enter one of the three functionality min Minimum of the three number is :4 Do you want to continue ? yes Enter one of the three functionality max Maximum of the three number Do you want to continue ? no BUILD SUCCESSFUL (total time: 36 seconds)
Create two java programs. The first will ask the user to enter three integers. Once the...
JAVA Ask the user for integers. If the user did not enter an integer, ask again. (Type Safe Input) Keep a running total of the intergers entered (sum). Once the user enters 0, stop looping. Print the sum of all the numbers. Do not use try-catch. EXAMPLE OUTPUT: Enter an integer, 0 to stop> [fasdfsa] Invalid input. Enter an integer, 0 to stop> [231.342] Invalid input. Enter an integer, 0 to stop> [1] Enter an integer, 0 to stop> [2]...
Create the following programs in Java {Java1 difficulty} [Please create as simple as possible] a. Ask the user to enter their favorite number and favorite word. Pass both of these values to a method that will print the favorite word vertically the favorite number of times. b. Ask the user to enter 2 integers. Pass the integers to 2 different methods: one method to add the integers and print the sum (from the method); the second method to multiply the...
Write a Java program to prompt for inputting an integer N, then enter N integers (a loop is needed), print the numbers user entered, and the amount of even and odd numbers (zero is even number). (1) Prompt for the user to input an integer and output the integer. (1 pts) Enter an integer: You entered: 5 (2) Prompt for the user to input N integers, output the numbers entered and the amount of even and odd numbers (9 pts)...
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...
Write a program in JAVA that asks the user to enter an integer. Store the integers in an array. Allow for up to 10 integers. When the user enters -1, the program should end. Print the number of integers entered as well as the number of times each integer was entered.
JAVA Write a program which will receive three pieces of data from the user: two floating point numbers, and a single character +, -, *, or /. Perform input validation on the character. Your code then will send these three pieces of data to a method which will calculate and output the results based on the user's entries. For example, if the user entered: "12.1, 23.2, +" the output would be "12.1 + 23.2 = 35.3." STRONG HINT: in a...
Create a program in Java with the following requirements: Using a Scanner and print statements, ask the user to input 3 numbers. Use Java’s int data type…don’t worry about error checking for this assignment (assume the user doesn’t try to break your program) Store these three numbers into three variables Calculate the sum of all three numbers Calculate the product of all three numbers If all three numbers are even, output “Lucky Duck!” If all three numbers are odd, output...
C++
Write a program that prompts the user to enter integers or a sentinel to stop. The program prints the highest and lowest numbers entered, the sum and the average. DO NOT USE ARRAYS, only variables and loops. Write a program the prompts the user to input a positive integer. Keep asking the user until a positive integer is entered. Once a positive integer is entered, print a message if the integer is prime or not. (NOTE: A number is...
In this assignment you will create two Java programs: The first program will be a class that holds information (variables) about an object of your choice and provides the relevant behavior (methods) The second program will be the main program which will instantiate several objects using the class above, and will test all the functions (methods) of the class above. You cannot use any of the home assignments as your submitted assignment. Your programs must meet the following qualitative and...
In Java
Write a program that will ask the user for integers and print if the integer is positive, negative or zero. The program should continue asking for integer until the user enters a negative value.