Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can you please help me with writing the code for this in Java, its a simple short beginner problem so please don't think that its

Can you please help me with writing the code for this in Java, its a simple short beginner problem so please don't think that its a long problem. Thank you

Problem:

Write a Java application having the class name Container that calculates How many and what size containers are needed to ship widgets.

Java Programming Assignment

Features:

  • Sequence structure
  • Arithmetic operators: +, *, %
  • Use of double and ints for variable declarations
  • Interactive input
  • Appropriate use of CONSTANTS (final declaration)
  • Appropriate documentation

A shipping clerk at a plant that manufactures widgets is faced with a problem. Widgets are very delicate and must be shipped in special containers. These containers are available in four sizes: huge, large, medium, and small, which can hold 50, 20, 5 and 1 widgets, respectively. The cost of each of the containers, at this time, is $35.00 (huge), $15.25 (large), $4.25 (medium) and $0.95 (small). [These costs are subject to occasional change so your program should declare these costs as constants (final).]

Write a program that reads the number of widgets to be shipped and prints the number of huge, large, medium, and small containers needed to send the shipment in the minimum number of containers with the minimum amount of wasted space (Example: you can't ship 3 widgets in a medium box - you must use 3 small boxes). Also, print the total cost of the containers. The program output should look like this (Note: user input is indicated by Bold. In your program, it will not be in bold)

Note: Everywhere above that you see an actual number, you should replace that value with a declared constant in your program.

For example

final int HUGE_CAPACITY = 25;

Widget Manufacturing Company

Container Information Program

Enter the number of widgets to be shipped: 1098

Container(s)

Number

==========

=====

Huge

21

Large

2

Medium

1

Small

3

=======

======

Total Cost

$772.60

Container Information Program completed.

Follow the style guidelines (i.e., choice of variables, using named constants, adequate commenting, easy to read source code, uniform indenting, etc.)

Some hints for the solution were given in class (Pennies, pennies, pennies

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Automating Access Databases With Macros

Authors: Fish Davis

1st Edition

1797816349, 978-1797816340

More Books

Students also viewed these Databases questions