First class mail has no insurance, and costs $1 plus 17 cents for each ounce up to a maximum of 13 ounces.

The first trick here is that your weight is stored in pounds and the description of the cost formula is in ounces. You do remember how to convert pounds to ounces, right? (If not, ask somebody.)

The second trick is that charges go up in 17 cent increments from a dollar. So, a .5 ounce package costs $1.17, and a 1.5 ounce package costs $1.34. You will need to do a little math here. You can google on Math.ceil() and Math.floor(). Math.ceil(double x) rounds x up to the next largest integer-equivalent number. So Math.ceil(1.5) returns 2.0. Math.floor(double x) rounds x down to the next largest integer-equivalent number. So Math.floor(1.5) returns 1.0.

I need help with coming up with that sort of math method. I can't figure it out.

```
public double calculateCostOfPostage()
{
double cost= 0;
insuranceAmount=0.0;
weight=super.returnWeight();
double ounce= 0;
ounce = weight*16;
if (ounce<=13)
{
cost = 1.0 + Math.ceil(ounce*.17);
cost = cost +insuranceAmount;
}
return cost;
}
```

That is what i have so far.

*Edited 3 Years Ago by mike_2000_17*: Fixed formatting