Question: Using eclipse under the com package create GroceryDemo class Methods: Create a total of 3 methods. A method called calculate Total that passes in the
Using eclipse under the com package create GroceryDemo class Methods: Create a total of 3 methods. A method called calculate Total that passes in the following parameters: the item price (double). the quantity sold (int) and the sales tax (double) and returns a double. It will calculate the total using the following algorithm: (price * sold) *(1 + tax/100). Ex: price is $1. items sold is 10, tax is 5%, the method would return 10.1 A method called calculate Average Sold that passes in five integers (for items sold on Monday, Tuesday, Wednesday, Thursday, and Friday). It returns and int for the average items sold (rounded down). Ex: If items sold were 10, 5, 8, 2, 4. The average would be (10+5+8+2+4)/5 which equals 5 (rounded down). A method called calculateProfit that passes in a purchaseCost(double), a soldCost (double), and a quantity (int). It will return the profit using this algorithm: (soldCost - purchaseCost) quantity Please have the main test all three methods. Class Outline: Package com Class: GroceryDemo main(String(): void calculate Total(double, int, double): double calculate Average Sold(int, int, int, int, int): int calculate Profile(double, double, int): double
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
