Question: When solving the source code I keep getting the following error What am I doing wrong ? ? Customer.java package daway.s; private class Customer {

When solving the source code I keep getting the following error
What am I doing wrong ??
Customer.java
package daway.s;
private class Customer {
}
private String name;
private String address;
private String phone;
private String email;
private String petName;
private String petType;
private int petAge;
private double petWeight;
public class Customer (public Customer(String name, String address, String phone, String email, String petName, String petType, int petAge, double petWeight)){
{
this.name = name;
this.address = address;
this.phone = phone;
this.email = email;
this.petName = petName;
this.petType = petType;
this.petAge = petAge;
this.petWeight = petWeight;
}
public String getName(){
return name;
}
public String getAddress(){
return address;
}
public String getPhone(){
return phone;
}
public String getEmail(){
return email;
}
public String getPetName(){
return petName;
}
public String getPetType(){
return petType;
}
public int getPetAge(){
return petAge;
}
public double getPetWeight(){
return petWeight;
}
}
Invoice. Java
package daway.s;
public class Invoice
{
private static final double SALES_TAX_RATE =0.0925;
private Customer customer;
private double serviceCharges;
private double medicationCharges;
public Invoice(Customer customer, double serviceCharges, double medicationCharges){
this.customer = customer;
this.serviceCharges = Math.max(0, serviceCharges);
this.medicationCharges = Math.max(0, medicationCharges);
}
private double calculateSalesTax(){
return Math.round(serviceCharges * SALES_TAX_RATE *100.0)/100.0;
}
public double calculateTotalCharges(){
return serviceCharges + medicationCharges + calculateSalesTax();
}
public void printInvoice(){
DecimalFormat df = new DecimalFormat("#.00");
System.out.println("Customer Name: "+ customer.getName());
System.out.println("Customer Address: "+ customer.getAddress());
System.out.println("Customer Phone: "+ customer.getPhone());
System.out.println("Customer Email: "+ customer.getEmail());
System.out.println("Pet Name: "+ customer.getPetName());
System.out.println("Pet Type: "+ customer.getPetType());
System.out.println("Pet Age: "+ customer.getPetAge());
System.out.println("Pet Weight: "+ customer.getPetWeight());
System.out.println("Service Charges: $"+ df.format(serviceCharges));
System.out.println("Medication Charges: $"+ df.format(medicationCharges));
System.out.println("Sales Tax: $"+ df.format(calculateSalesTax()));
System.out.println("Total Charges: $"+ df.format(calculateTotalCharges()));
}
}
Main.java
package daway.s;
import java.util.Scanner;
public class Main {
public static void main(String[] args)
{
java.util.Scanner scanner = new java.util.Scanner(System.in);
System.out.print("Enter customer name: ");
String name = scanner.nextLine();
System.out.print("Enter customer address: ");
String address = scanner.nextLine();
System.out.print("Enter customer phone number: ");
String phone = scanner.nextLine();
System.out.print("Enter customer email: ");
String email = scanner.nextLine();
System.out.print("Enter pet name: ");
String petName = scanner.nextLine();
System.out.print("Enter pet type: ");
String petType = scanner.nextLine();
System.out.print("Enter pet age: ");
int petAge = scanner.nextInt();
System.out.print("Enter pet weight: ");
double petWeight = scanner.nextDouble();
System.out.print("Enter service charges: ");
double serviceCharges = scanner.nextDouble();
System.out.print("Enter medication charges: ");
double medicationCharges = scanner.nextDouble();
Customer customer = new Customer(name, address, phone, email, petName, petType, petAge, petWeight);
Invoice invoice = new Invoice(customer, serviceCharges, medicationCharges);
invoice.printInvoice();
scanner.close();
}
}
 When solving the source code I keep getting the following error

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!