Write a java program to prompt the user to enter three doubles and compute the sum and product. Print "The sum is 999 and the product is 999.", where 999 is replaced with the user sum and product.
Dear Student ,
As per the requirement submitted above , kindly find the below solution.
Here a new java program with name "main.java" is created, which contains following code.
main.java :
//Java program to compute sum and product of numbers
import java.util.*;//import packages
public class Main //Java Class
{ //entry point of program that is main
public static void main(String[] args) {
//creating object of Scanner class
Scanner sc=new Scanner(System.in);
//asking user to enter num1
System.out.print("Enter number 1 :
");
double
num1=sc.nextDouble();//reading num1
//asking user to enter num2
System.out.print("Enter number 2 :
");
double
num2=sc.nextDouble();//reading num2
//asking user to enter num3
System.out.print("Enter number 3 :
");
double
num3=sc.nextDouble();//reading num3
//compute sum of numbers
double sum=num1+num2+num3;
//compute product of numbers
double
product=num1*num2*num3;
//print sum and product
System.out.println("The sum is
"+sum+" and the product is "+product+".");
}
}
======================================================
Output : Compile and Run above program to get the screen as shown below
Screen 1 :main.java
NOTE : PLEASE FEEL FREE TO PROVIDE FEEDBACK ABOUT THE SOLUTION.
Write a java program to prompt the user to enter three doubles and compute the sum...
In Java please: Write a program that will prompt the user to enter GPA values one per line, stopping when the user enters a negative Input: value. Print the following on separate lines: . The number of vaild GPAs entered » The sum of the GPAs 4.0 3.7 2.9 3.5 -1 The average GPA
Java Write a program that prompt the user to enter a decimal number representing the radius of a circle. If the number is greater or equal to zero, the program displays the area of the circle. Otherwise, the program displays “negative input”
In Java - Write a program that prompts the user to enter two integers and displays their sum. If the input is incorrect, prompt the user again. This means that you will have a try-catch inside a loop.
Write a Java program that performs these operations Prompt the user to enter a low height in feet (an integer) Prompt the user to enter a high height in feet (an integer) Prompt the user to enter a low weight in pounds (an integer) Prompt the user to enter a high weight in pounds (an integer) Print a table of Body Mass Index (BMI) for the heights and weights entered, ranging from the low height to the high height (inclusive),...
Write a Java program to meet the following requirements: 1. Prompt the user to enter three strings by using nextLine(). Space can be part of the string). ( Note: your program requires using loop: for-loop, while-loop or do-while-loop to get the input String ) 2. Write a method with an input variable (string type).The method should return the number of lowercase letters of the input variable. 3. Get the number of the lowercase letters for each user input string by...
Write a program that will compute the user annual salary. Prompt the user the enter (1) the weekly salary. Store the information in a double variable. Prompt the user to enter the number of weeks worked in a year. Use an int variable for that. Write code that will compute the user's Annual salary. Gross salary is salary before any deductions are taken. Update the code and prompt the user to enter the federal tax rate and the state's tax...
Write a program in Java language to prompt the user to enter 3 integers (A, B, and C) then display these numbers from the lowest to the highest (sorted ascendingly) . Note that there are 6 different cases to handle proper order. As an example, a user entered 10 for A, 5 for B and 14 for C: the output of the program should look like this Enter number A? 10 Enter number B? 5 Enter number C? 14 Your...
in java 3) Sum. Write a program that prompts the user to read two integers and displays their sum. Your program should prompt the user to read the number again if the input is incorrect.
Write a programming java that prints the sum of cubes. Prompt for and read two integer values from the user and print the sum of each value raised to the third power, i.e., (?3+?3). Sample output: (user input) Enter x as an int: 3 Enter y as an int: 4 (3^3) + (4^3) = 91
Write a java program that asks the user to enter 2 integers, obtains them from the user, determines if they are even or odd numbers and prints their sum, product, difference, and quotient (Division).