Question
-java code is being used for this program- You will be creating a program that will sell boxes to the user. The user will need
-java code is being used for this program-
You will be creating a program that will sell boxes to the user. The user will need to enter the dimensions of the box, the price per cubic foot, and the quantity of boxes. The program will compute the volume, price per box, and the total price after taking quantity into account. Part 1: User Input Collect the following information from the user: The box's length (floating-point number) The box's width (floating-point number) The box's height (floating-point number) The price per cubic foot inch (floating-point number) I made a mistake here. It should be price per cubic inch, not price per cubic foot. The demo above should have been asking for the price per cubic inch. The number of boxes they want to purchase (integer value) We are assuming all measurements are inputted as inches. Part 2: Computations Based on the information obtained in Part 1, compute the following: The volume of the box (float-point number) This can be calculated with this formula: (volume) = (length) x (width) x (height) The price per box (floating-point number) The user has already given you the price per cubic foot inch, so based on the data given, you need to figure out how much a single box costs based on its volume. The total price of their purchase (floating-point number) The total price is determined by: (total price) = (price per box) x (quantity) For this assignment, use variables to store the results of your computations. Make sure you apply the correct data type to your variables. Part 3: Displaying the results Display the results back to the user in such a way that makes sense to them. You should summarize the following: The information inputted by the user. The information you computed. You especially need to make it clear what the total price of the purchase is.
below is attached code i have begun to workout; i know there is issues with my code but it is the starting point before i submitted question not sure if i'm on the correct path or not.
package com.company;
import java.util.Scanner; public class PriceCalculator { public static void main(String[] args) { // write your code here Scanner sc = new Scanner(System.in); int volume = 0; int width = 0; int length = 0; int height = 0; int quantity = 0; double TotalPrice = sc.nextDouble(); double PricePerBox = sc.nextDouble(); //questions for user input System.out.println("Please enter box length "); System.out.println("Please enter box width"); System.out.println("Please enter box height"); System.out.println("Please enter box price per cubic inch"); System.out.println("Please enter number of boxes"); // math for the boxes (volume) = (length) * (width) * (height); (TotalPrice) = (PricePerBox) * (quantity); System.out.println("your TotalPrice is: " + quantity ); System.out.println("your PricePerBox is: " + quantity); } }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started