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
Copy the below code in SumOfCubes.java file
******SumOfCubes.java*****
import java.util.Scanner;//importing scanner class
public class SumOfCubes // defiining class
{
public static void main(String args[]){
int x,y,sum; // taking integer type variables
Scanner sc = new Scanner(System.in); //making scanner object
System.out.println("Enter x as an int:"); // printing
x = sc.nextInt(); // string in x
System.out.println("Enter y as an int:"); // printing
y = sc.nextInt(); // storing in y
sum= (x*x*x)+(y*y*y); // calculating sum
System.out.println("("+x+"^3) + ("+y+"^3) = "+sum); // displaying sum with equation
}
}
Screenshot for orientation:
Two Output examples:
Extra Note-
Every thing after "// " is a comment , it is ignored by the compiler
Give special attention to spellings. And letter case
+ Is used for concatenation of strings
Any thing else let me know in the comment
Thank if this answer helps you please up vote thnk you !
Write a programming java that prints the sum of cubes. Prompt for and read two integer...
RAPTOR PROGRAMMING Write a program which will receive two integer values as input. Then prompt the user to choose one of the following operations and produce an output with the selected operation. 1. Addition 2. Subtraction 3. Multiplication 4. Division 5. Modulo Division Example output with response: Please enter an input: 2 Please enter another input: 3 Please choose from the follow: 1. Addition 2. Subtraction 3. Multiplication 4. Division 5. Modulo Division Output: 2 % 3 is 2.
C Programming For this task, you will have to write a program that will prompt the user for a number N. Then, you will have to prompt the user for N numbers, and print then print the sum of the numbers. For this task, you have to create and use a function with the following signature: int sum(int* arr, int n); Your code should look something like this (you can start with this as a template: int sum(int* arr, int...
Programming in C: Write a program that accepts an integer and two floating-point values and prints the sum of these values. Example: Input:12,13.14,6.7; Output:31.84. Use formatted I/O
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.
A perfect number is a positive integer that is equal to the sum of its (proper) positive divisors, including 1 but excluding itself. A divisor of a number is one which divides the number evenly (i.e., without a remainder). For example, consider number 6. Its divisors are 1, 2, 3, and 6. Since we do not include number itself, we only have 1, 2, and 3. Because the sum of these divisors of 6 is 6, i.e., 1 + 2...
C programming! Write a program that reads integers until 0 and prints the sum of values on odd positions minus the sum of values on even positions. Let ?1, ?2, … , ??, 0 be the input sequence. Then the program prints the value of ?1 − ?2 + ?3 − ?4 + ⋯ ??. The input is a sequence of integers that always contains at least 0 and the output will be a single number. For example, for input...
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.
Write a Python program to prompt the user for an integer number. Assign this integer to a variable X. Then assign a variable Y to the X**3 (X to the power 3). Finally, assign the variable Z to the square root of Y and print the values of X, Y, and Z as shown in the example below. Use main() function to define and call the program. Example: Enter an integer number: 3 X = 3 if Y=X**3 then Y...
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
This Java program reads an integer from a keyboard and prints it out with other comments. Modify the comments at the top of the program to reflect your personal information. Submit Assignment1.java for Assignment #1 using Gradescope->Assignemnt1 on canvas.asu.edu site. You will see that the program has a problem with our submission. Your program is tested with 4 testcases (4 sets of input and output files). In order to pass all test cases, your program needs to produce the same...