Create a java class named Shipment a. The program must ask for two separate packages to ship b. The program must calculate the cost difference using the difference in volume: i.e. The base price for a package with volume <=1 is $3, for every unit increase in volume, the cost increases by $1 e.g. 1: a parcel with volume 4, the cost is $3+ $1 +$1 +$1 = $6

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

2. Create a java class named Shipment

a. The program must ask for two separate packages to ship

b. The program must calculate the cost difference using the difference in volume:

i.e. The base price for a package with volume <=1 is $3, for every unit increase in volume, the cost increases by $1 e.g. 1: a parcel with volume 4, the cost is $3+ $1 +$1 +$1 = $6

e.g. 2: a parcel with volume 2.5, the cost is $3 + $1.5 = $4.5

c. Give the following (in order of priority):

i. If there is no difference, display the costs as the same

ii. If the cost of one is less than twice the other, display that it is “slightly more than”

iii. If the cost of one is less than three times the other, display that it is “twice”

iv. If the cost of one is less than four times the other, display that it is “triple”

v. If the cost of one is less than five times the other, display that it is “quadruple”

vi. Otherwise, display that as a calculated multiple (eg 5x, 6x etc)

c. The program must indicate the more costly package (if not same cost) and by how much

d. The program must calculate and display the appropriate message (including proper dimension and cost format) f. Your code also does NOT need to worry if the user inputs an invalid value for the input (example: invalid length). The output of your code must match the samples.

g. You must change the title

i.e. Welcome to shipping calculator! 

PS: Please upload the output and say the logic behind it. Thank you!

 

Welcome to John Doe's shipping calculator!
Enter first package dimensions
Enter length: 1
Enter width: 1
Enter height: 1
Enter second package dimensions
Enter length: 2
Enter width: 2
Enter height: 2
First package dimensions: 1.0 x 1.0 x 1.0, Volume = 1.0
Second package dimensions: 2.0 x 2.0 x 2.0, Volume = 8.0
Package 1 will cost $3.00 to ship.
Package 2 will cost $10.00 to ship.
The second package is triple the first package.
Welcome to John Doe's shipping calculator!
Enter first package dimensions
Enter length: 1
Enter width: 1
Enter height: 1
Enter second package dimensions
Enter length: 1
Enter width: 1
Enter height: 1
First package dimensions: 1.0 x 1.0 x 1.0, Volume = 1.0
Second package dimensions: 1.0 x 1.0 x 1.0, Volume = 1.0
Package 1 will cost $3.00 to ship.
Package 2 will cost $3.00 to ship.
The first package is the same cost as the second package.
Transcribed Image Text:Welcome to John Doe's shipping calculator! Enter first package dimensions Enter length: 1 Enter width: 1 Enter height: 1 Enter second package dimensions Enter length: 2 Enter width: 2 Enter height: 2 First package dimensions: 1.0 x 1.0 x 1.0, Volume = 1.0 Second package dimensions: 2.0 x 2.0 x 2.0, Volume = 8.0 Package 1 will cost $3.00 to ship. Package 2 will cost $10.00 to ship. The second package is triple the first package. Welcome to John Doe's shipping calculator! Enter first package dimensions Enter length: 1 Enter width: 1 Enter height: 1 Enter second package dimensions Enter length: 1 Enter width: 1 Enter height: 1 First package dimensions: 1.0 x 1.0 x 1.0, Volume = 1.0 Second package dimensions: 1.0 x 1.0 x 1.0, Volume = 1.0 Package 1 will cost $3.00 to ship. Package 2 will cost $3.00 to ship. The first package is the same cost as the second package.
UML diagram for reference:
Shipment
-package1: Package
-package2: Package
-message: String
- currency: NumberFormat
-decimal: DecimalFormat
+Shipment()
+ inputPackages(): void
+ inputPackage(Package): void
+ calculateCost(): void
+ display(): void
+ main(args: String[]); void
-length: double
-width: double
-height: double
Package
+ Package()
.
Package (double, double, double)
+ Package(Package)
+inputLength(): void
+inputWidth(): void
+inputHeight(): void
+ display Dimensions(): void
+ calcVolume(): double
Transcribed Image Text:UML diagram for reference: Shipment -package1: Package -package2: Package -message: String - currency: NumberFormat -decimal: DecimalFormat +Shipment() + inputPackages(): void + inputPackage(Package): void + calculateCost(): void + display(): void + main(args: String[]); void -length: double -width: double -height: double Package + Package() . Package (double, double, double) + Package(Package) +inputLength(): void +inputWidth(): void +inputHeight(): void + display Dimensions(): void + calcVolume(): double
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Developing computer interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education