I have finished most codes, but now I am stuck at how to use boolean to decide if the customer is qualified for a discount.
System.out.print("Enter invoice number: ");
int invoiceNum = console.nextInt();
System.out.print("Enter first name: ");
String firstName = console.next();
System.out.print("Enter last name: ");
String lastName = console.next();
System.out.println("Is the customer qualified for a discount? (Y or N): ");
String qualified = console.next();
System.out.print("Enter discount rate ( ex. 12 for 12%): ");
double discountRate = console.nextDouble();
return new Service(invoiceNum, firstName,lastName, true/*???*/, discountRate);
@Override
public double calculateCost(){
if(super.isIsQualifiedDiscount() == true){
double total = serviceCharge * (1 - (super.getDiscountRate() / 100));
System.out.printf("%nInspection Charge with Discount: %.2f", total);
return total;
}
else{
return serviceCharge;
}
}
@Override
public String toString() {
return "Inspection Service Charge: " + serviceCharge;
}
How should I connect these two parts so I can use Y or N to decide it?? below is my assignment picture:`` enter image description here