Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

public class Exercise 0 3 _ ShippingTotal { / * * Scamper Shipping Company specializes in small, local deliveries. * The problems below ask you

public class Exercise03_ShippingTotal {
/*
* Scamper Shipping Company specializes in small, local deliveries.
* The problems below ask you to implement the logic to calculate a shipping
* amount for a package.
*/
// You can use these constants in your solutions.
private final int MAX_WEIGHT_POUNDS =40;
private final double UP_TO_40_LB_RATE =0.50;
private final double OVER_40_LB_RATE =0.75;
/*
* Scamper Shipping Company charges $0.50 per pound for items up to and
* including 40 pounds. It charges $0.75 per pound for items over 40 pounds.
* Return the shipping rate when provided a weight in pounds.
*
* Examples:
* calculateShippingRate(10)0.50
* calculateShippingRate(25)0.50
* calculateShippingRate(40)0.50
* calculateShippingRate(45)0.75
*/
public double calculateShippingRate(int weightPounds){
return 0.0;
}
/*
* Scamper Shipping Company charges $0.50 per pound for items up to and
* including 40 pounds. It charges $0.75 per pound for items over 40 pounds.
* Implement the logic needed to calculate the shipping cost when provided a
* weight in pounds.
*
* You may use calculateShippingRate() in your solution.
*
* Examples:
* calculateShippingTotal(10)5.0
* calculateShippingTotal(25)12.5
* calculateShippingTotal(40)20.0
* calculateShippingTotal(45)33.75
*/
public double calculateShippingTotal(int weightPounds){
return 0.0;
}
/*
* Scamper Shipping Company now allows customers to provide a discount code to
* give them 10% off of their order.
* Implement the logic to calculate the correct shipping rate when provided a
* weight in pounds and a boolean value for hasDiscount.
*
* You may use any previous methods in your solution.
*
* Examples:
* calculateShippingTotal(10, false)5.0
* calculateShippingTotal(10, true)4.5
* calculateShippingTotal(25, false)12.5
* calculateShippingTotal(25, true)11.25
* calculateShippingTotal(40, false)20.0
* calculateShippingTotal(40, true)18.0
* calculateShippingTotal(45, false)33.75
* calculateShippingTotal(45, true)30.375
*/
public double calculateShippingTotal(int weightPounds, boolean hasDiscount){
return 0.0;
}
}

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

Database And Expert Systems Applications 22nd International Conference Dexa 2011 Toulouse France August/September 2011 Proceedings Part 1 Lncs 6860

Authors: Abdelkader Hameurlain ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2011th Edition

3642230873, 978-3642230875

More Books

Students also viewed these Databases questions

Question

Describe how to measure the quality of work life.

Answered: 1 week ago

Question

What attracts you about this role?

Answered: 1 week ago