1. Engineering
  2. Computer Science
  3. as input let the user enter the number of cars...

Question: as input let the user enter the number of cars...

Question details

As input, let the user enter the number of cars in a shipment As output, report the number of large carriers, medium carriers and trailers that are required to complete the shipment. 1. Create a new NetBeans project called yourname Lab2 2. Create three named constants with literal values based on the table below. Use the appropriate variable type: Constant represents What it should store Large carrier capacity Medium carrier capacity Trailer capacity Hint: In your code, constants should be declared outside the main method- below the class declaration and above the main method. Hint: See the last few slides of the Module 1 slides for examples of how to define constants o o 3. The rest of your code goes in the main method, as described in the next set of steps 4. Prompt the user to enter the number of cars o Hint: Look at the Module 1 slides for examples of text output 5 Store the input value in a integer-typed variable Hint: Use the Scanner example from the Module 1 slides. You will need to add an import statement for the Scanner class at the top of your code, below the package line. Hint: Based on the example from the Module 1 slides, use the nextint) method. o 6. Find the number of large carriers that are needed and store the value in an integer variable. o Think about this: Which math operation should you be using here? What should be the operands? 7. After we fill all large carriers we can, find the number of cars that are left over. Store this value in an integer variable. Think about this: Which math operation should you be using here? Which operator provides a remainder (check the Module 2 slides)? What should be the operands? o 8. Find the number of medium carriers that are needed for the cars not shipped by the large carriers, and store the value in an integer variable 9. After the medium carriers are filled to capacity, find the number of cars that are left over. These cars are going to be shipped in trailers, and since each trailer can hold 1 car, this is the number of trailers to be used. Store this value in an integer variable 10. Following the sample output below, report the following information, in the order below o The number of large carriers used o The number of medium carriers used o The number of trailers used 11. When your code is working, upload your java file to the week 3 in-class lab dropbox SAMPLE OUTPUT
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution