
Hi I have a project due in my class and I cant seem to get it to work right. I think i'm missing something but I don't know what. Here is the assignment below I copied and pasted it.
Write a Java program that computes the total surface area of a rectangular prism like the one below. There are six sides, so the area of all sides has to be summed to get total area.
The formula for area is: area = length x width; area = length x height; or area = width x height, depending on the side being calculated.
The units for area is units squared. For example, if length, width, and height are given in inches, then the units for area would be inches2, which we call "square inches".
Step 1. Create an
Step 2. Code the program in Eclipse to compute the area.
Inputs: The program should ask the user to enter the length (L), width (W), and height (H) for the object in inches. So there are three inputs to the program.
Create a separate method from main to calculate the area.
Name the separate method calcArea and it needs to have three input arguments: length, width, and height. The output of calcArea will return a double.
Outputs: The program should have this output (below is an example):
The total area for a rectangle prism <L> inches long, <W> inches wide, and <H> inches tall is <A> square inches.
Where A is the area your program calculates and must be formatted to two decimal places, e.g. 12.48, using a printf statement.
Step 3. Test your program by computing the area of a rectangular prism that has a length of 4 inches, width of 2 inches, and a height of 1 inch. Use the Snip It tool in Windows or a similar tool on the Mac to cut and paste the Eclipse Console output window into the same Word document as the algorithm in Step 1.
Now here is my code i'm trying to get to work.
package labs;
import java.util.Scanner;
public class Newsummerprism {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
// initialize the variables
double length = 0;
double width = 0;
double height = 0;
// prompt for user input
System.out.print("Enter the legth of the prism:");
length = input.nextDouble();
System.out.print("Enter the width of the prism:");
width = input.nextDouble();
System.out.print("Enter the height of the prism:");
height = input.nextDouble();
System.out.printf("The total area for a rectangle prism is %.2f inches long, %.2f inches wide, %.2f inches tall is %.2f square inches\n",
length, width, height, Area);
}
// make new method
public static double calcArea (double length, double width, double height){
double Area = 2 * (length * width + length * height + width * height);
return Area;
}
}
Let me know what I am doing wrong or what I am missing. Thanks

Trending nowThis is a popular solution!
Step by stepSolved in 4 steps with 2 images

- When we say arithmetic expression, we mean a kind of expression you can type in a very basic desk calculator. That is, neither variables nor brackets are allowed. It contains only numbers and four arithmetic operators, +, -, *, and /. The following are some examples of arithmetic expression: Any number string with or without signs - e.g. 3, -1, +10, 3.14, -0.70 and 099. Number strings mixed with arithmetic operators - e.g. 3+5, -1+2*3, 7/10-0.7, and -1.4-+8.2. An example of FA diagram for recognising a non-negative integer is given below. You may use it as a start point. You need to add a few more states and transitions to handle numbers with decimal point and signs (e.g. -5, +2, 0.21, -32.6, +99.05, but not the form 1.0E-3). Most importantly, you also need to add a few more things to deal with the arithmetic operators +, -, *, /.arrow_forwardIN JAVA - Write a program whose input is two integers, and whose output is the first integer and subsequent increments of 5 as long as the value is less than or equal to the second integer. End with a newline. Ex: If the input is: -15 10 the output is: -15 -10 -5 0 5 10 Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first. For coding simplicity, output a space after every integer, including the last. BASE CODE: import java.util.Scanner; public class LabProgram { public static void main(String[] args) { /* Type your code here. */ }}arrow_forwardImplement a python version of the game Hangman in which a player attempts to guess a secret word one letter at a time. Normally Hangman is a two-player game but in your version the user will play three rounds against the computer. Use the following as the secret word in each round: 1. “APPLE”2. “OBVIOUS”3. “XYLOPHONE” Here are the steps to follow in each round: Print the secret word with each letter replaced with the underscore character, “_” Prompt the user to enter a letter or word using the following message, “Enter a letter or word: ”. If the user enters a single letter, check if that letter is in the secret word (case-insensitive). The user can make up to 6 letter guesses in a round. If the user guesses a letter they have already guessed, print the message “You've already guessed that letter!” and don’t count it as one of their 6 guesses. Go straight to step 6. If the user enters a word, check if the word matches the secret word (case-insensitive). Word guesses should not…arrow_forward
- I need help making a JAVA codearrow_forwardSuppose that a friend tells you a phone number that you need to dial, as soon as you are done talking. You don’t have a pencil, so you remember it by grouping it into two sections, one with three digits, and one with four digits. The method you have used is calledarrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education





