ave three privateinstance variables of type double named length, width, and height. Package should have one privateinstance variable of the type Scanner named input, initialized to in. No-args(explicit default) public constructor, which initializes all three double instance variables to 1.0. Initial(parameterized) public constructor, which defines three parameters of type double, named length, width, and height, which are used to initialize the instance variables of same name. Public copyconstructor, with a parameter of type Package, used to duplicate an existing Package object. Three public void methods named inputLength,inputWidth, and inputHeight. Each method will prompt the user for the appropriate property, and input a double value using the Scanner object input to initialize the instance variables A public voidmethod named displayDimensions which prints the dimensions as length X width X height (each value separated by a “ X “). A public method of type double named calcVolumethat calculates the volume and returns the result as a double value. Create a class named Shipment
ave three privateinstance variables of type double named length, width, and height. Package should have one privateinstance variable of the type Scanner named input, initialized to in. No-args(explicit default) public constructor, which initializes all three double instance variables to 1.0. Initial(parameterized) public constructor, which defines three parameters of type double, named length, width, and height, which are used to initialize the instance variables of same name. Public copyconstructor, with a parameter of type Package, used to duplicate an existing Package object. Three public void methods named inputLength,inputWidth, and inputHeight. Each method will prompt the user for the appropriate property, and input a double value using the Scanner object input to initialize the instance variables A public voidmethod named displayDimensions which prints the dimensions as length X width X height (each value separated by a “ X “). A public method of type double named calcVolumethat calculates the volume and returns the result as a double value. Create a class named Shipment
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
Related questions
Question
Develop a Shipping Calculator Java application, which contains the concepts of a Java object and class.
- This Java Program must include the declaration and definition of object and class.
The steps for the program are outlined below:
- Create a Java class named Package that contains the following:
- Package should have three privateinstance variables of type double named length, width, and height.
- Package should have one privateinstance variable of the type Scanner named input, initialized to in.
- No-args(explicit default) public constructor, which initializes all three double instance variables to 1.0.
- Initial(parameterized) public constructor, which defines three parameters of type double, named length, width, and height, which are used to initialize the instance variables of same name.
- Public copyconstructor, with a parameter of type Package, used to duplicate an existing Package object.
- Three public void methods named inputLength,inputWidth, and inputHeight. Each method will prompt the user for the appropriate property, and input a double value using the Scanner object input to initialize the instance variables
- A public voidmethod named displayDimensions which prints the dimensions as length X width X height (each value separated by a “ X “).
- A public method of type double named calcVolumethat calculates the volume and returns the result as a double value.
- Create a class named Shipment
- The program mustask for two separate packages to ship
- The program mustcalculate 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
- Give the following (in order of priority):
- If there is no difference, display the costs as the same
- If the cost of one is less than twice the other, display that it is “slightly more than”
- If the cost of one is less than three times the other, display that it is “twice”
- If the cost of one is less than four times the other, display that it is “triple”
- If the cost of one is less than five times the other, display that it is “quadruple”
- Otherwise, display that as a calculated multiple (eg 5x, 6x etc)
- The program mustindicate the more costly package (if not same cost) and by how much
- The program mustcalculate and display the appropriate message (including proper dimension and cost format)
- 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 mustmatch the samples.
- You must change the title i.e. Welcome to <your name> shipping calculator!
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images
Knowledge Booster
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.Recommended textbooks for you
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education