1. Inside model package create a class änd ca (String), shippingAddress (String), weight (double), shippingRate(double). 2. Write a no-argument constructor, Set the default shipping rate to 10QR/kg. 3. Write a three-argument constructor for (customerld, shippingAddress, weight). You should call the no-arguemnt constructor to set the default value of the shipping rate, 4. Write a fully parameterized constructor for the four attributes. You should use the previous constructor for the first three arguments. 5. Generate setters and getters for all attributes: a. You should ensure weight will never be negative everywhere b. shippingRate must be greater than 0 and less than 40, otherwise set it to 10. 6. Write a method called getShipmentPrice(). The method should set 30 OR for the first 1kg and IshippingRate * weight) for every extra kg. 7. Create another class called ShipmentTest with a main method to test your class: a. Create 2 shipment objects: i. For the first one, use the no-argument constructor. Set the weight of the object using the setter to 3.45. ii. For the second one, use the fully parametrized constructor. Set the shipping rate to 20 and the weight to 1.5. b. Print out the shipment price of both objects as shown in the sample output. Sample output: Shipping price for shipemnt of weight 3.45 kg is 54.50 QAR Shipping price for shipemnt of weight 1.50 kg is 40.00 QAR
1. Inside model package create a class änd ca (String), shippingAddress (String), weight (double), shippingRate(double). 2. Write a no-argument constructor, Set the default shipping rate to 10QR/kg. 3. Write a three-argument constructor for (customerld, shippingAddress, weight). You should call the no-arguemnt constructor to set the default value of the shipping rate, 4. Write a fully parameterized constructor for the four attributes. You should use the previous constructor for the first three arguments. 5. Generate setters and getters for all attributes: a. You should ensure weight will never be negative everywhere b. shippingRate must be greater than 0 and less than 40, otherwise set it to 10. 6. Write a method called getShipmentPrice(). The method should set 30 OR for the first 1kg and IshippingRate * weight) for every extra kg. 7. Create another class called ShipmentTest with a main method to test your class: a. Create 2 shipment objects: i. For the first one, use the no-argument constructor. Set the weight of the object using the setter to 3.45. ii. For the second one, use the fully parametrized constructor. Set the shipping rate to 20 and the weight to 1.5. b. Print out the shipment price of both objects as shown in the sample output. Sample output: Shipping price for shipemnt of weight 3.45 kg is 54.50 QAR Shipping price for shipemnt of weight 1.50 kg is 40.00 QAR
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
Question is to write code if shipment. And shipmenttest in JAVA.
Thank you
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 6 steps with 4 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY