I have this assignment and I am about to throw this laptop. The following code runs, but when I test it in MindTap I get the bottom message. I don't know what I am doing wrong or why it says incorrect.
Assignment: Write three overloaded computeBill methods for a photo book store:
When computeBill receives a single parameter, it represents the price of one photo book ordered. Add 8% tax, and return the total due. When computeBill receives two parameters, they represent the price of a photo book and the quantity ordered. Multiply the two values, add 8% tax, and return the total due. When computeBill receives three parameters, they represent the price of a photo book, the quantity ordered, and a coupon value. Multiply the quantity and price, reduce the result by the coupon value, and then add 8% tax and return the total due.
My Coding:enter code here public class Billing {
public static void main(String args[]){
double yourTotal;
yourTotal = computeBill(31.00);
displayTotal (yourTotal);
yourTotal = computeBill (31, 2);
displayTotal(yourTotal);
yourTotal = computeBill(31, 2, .2);
displayTotal (yourTotal);
}
public static double computeBill (double price)
{double total = price * 1.08;
System.out.println ("You ordered 1 photobook for $" + price);
System.out.println("Plus sales tax 8%");
return total;}
public static double computeBill (double price, int qty) {
double subtotal = price * qty;
double total = subtotal * 1.08;
System.out.println ("You ordered" + qty + " photobook(s) for $" + price);
System.out.println("Subtotal =" + subtotal);
System.out.println("Plus sales tax 8%");
return total;
}
public static double computeBill (double price, int qty, double discount) {
double subtotal = price * qty;
subtotal = subtotal - (subtotal * discount);
double total = subtotal * 1.08;
System.out.println ("You ordered " + qty + " photobook(s) for $" + price);
System.out.println("Subtotal = " + subtotal);
System.out.println("Less your " + (discount * 100) + "% discount");
System.out.println("Plus sales tax 8%");
return total;
}
public static void displayTotal (double total){
System.out.println("Total: $" + total);
}
}
Result MindTap gives me when I test: Build Status Build Succeeded Test Output You ordered2 photobook(s) for $31.0 Subtotal =62.0 Plus sales tax 8% [FAILED]: unitTest(CodevolveTest12f618f0): null false Test Contents Billing tester30 = new Billing();
@Test
public void unitTest() {
assertTrue(tester30.computeBill(31, 2) == 66.96);
}
Someone please help me. I am sooooo stuck!!!`