Write a method called CalculateShipping that computes and returns the shipping cost of an item for an online store.
The store's shipping policy states that shipping costs 75 cents per item, plus 25 cents for each ounce of product weight. There is an exception for items priced $100.00 or more, for which shipping is free.
So for an item that costs $12.99 and weighs 6 ounces, the shipping cost is computed as $0.75 + 6 * $0.25 = $2.25. For an item that costs $150.00, shipping costs $0.00.
Also write calls to the method that compute the shipping costs for the 2 above examples, placing the results in variables named cheapItem and expensiveItem.
Java code :
class Main{
static double calculateShipping(double cost, double weight){
if(cost>=150){
return 0;
}
return (75d+25d*weight)/100d;
}
public static void main(String[] args) {
double cheapItem = calculateShipping(12.99, 6);
double expensiveItem = calculateShipping(150, 10);
System.out.println("Shipping Cost of cheap item is
$"+cheapItem);
System.out.println("Shipping Cost of expensive item is
$"+expensiveItem);
}
}
OUTPUT :
Write a method called CalculateShipping that computes and returns the shipping cost of an item for...
Bryer Company has used the FIFO method of valuing its inventory for the prior 12 years. The accountants at Bryer Company would like to switch to LIFO since the economy is suffering from severe inflation. For the switch to occur Bryer Company must have its auditor's approval and place a note in its financial statements, also, the auditor must refer to the change in its audit opinion. Bryer Company cannot make a change to its inventory valuation method once a...
Develop and write the complete Price Equation for an Apple iPad. Students identify the costs, discounts, fees/charges, etc. for each item listed to complete the Price Equation for an Apple iPad Air. Here are some of the accessories and options available: a. List Prices—Apple Online Store: (NOTE: APPLE’S PRICES MAY CHANGE TO NEW PRICES WITHOUT NOTICE.) – Apple iPad Air Finish/Model: Black/Space Gray, 128GB, Wi-Fi + Cellular; MSRP is $929.00. – Network Carrier—Verizon: Assume you’re a heavy data user (video downloads, Internet...