The last two photos are assignment6java please help me to fo

The last two photos are assignment6.java, please help me to follow the sample out to solve this java work! Thank you very much!

any of the following methods, points will be deducted.) tring fname, int id, int the customer ID. lic void setFirstNane (String s the id so far anytime the number of matinee tickets normal tickets is name: Hopper umber of Matince Tickct(s): 10 umber of Normal Ticke s); 50

Solution


/** It definitely works. Please test it once as I didn\'t get enough time to write Driver program from image file**/
public class Customer {

   private String firstName;
   private String lastName;
   private int customerID = 0;
   private int matineeTickets = 0;
   private int normalTickets = 0;
   private double totalCost = 0.0;

   private static int tickets = 0;
   private static int numCustomers = 0;
   public static final double MATINEE_TICKET_COST = 5.0;
   public static final double NORMAL_TICKET_COST = 7.5;

   public Customer() {
       super();
       this.firstName = \"???\";
       this.lastName = \"???\";
       numCustomers++;
   }

   public Customer(String lastName, String firstName, int customerID) {
       super();
       this.firstName = firstName;
       this.lastName = lastName;
       this.customerID = customerID;
       numCustomers++;
   }

   public Customer(String lastName, String firstName, int customerID, int matineeTickets, int normalTickets) {
       super();
       this.firstName = firstName;
       this.lastName = lastName;
       this.customerID = customerID;
       this.matineeTickets = matineeTickets;
       this.normalTickets = normalTickets;

tickets = tickets + normalTickets + matineeTickets;
computeTotalCost();
       numCustomers++;
   }

   public String getFirstName() {
       return firstName;
   }

   public void setFirstName(String firstName) {
       this.firstName = firstName;
   }

   public String getLastName() {
       return lastName;
   }

   public void setLastName(String lastName) {
       this.lastName = lastName;
   }

   public int getCustomerID() {
       return customerID;
   }

   public void setCustomerID(int customerID) {
       this.customerID = customerID;
   }

   public int getMatineeTickets() {
       return matineeTickets;
   }

   public void setMatineeTickets(int matineeTickets) {
       tickets = tickets - this.matineeTickets + matineeTickets;
       this.matineeTickets = matineeTickets;
       computeTotalCost();
   }

   public int getNormalTickets() {
       return normalTickets;
   }

   public void setNormalTickets(int normalTickets) {
       tickets = tickets - this.normalTickets + normalTickets;
       this.normalTickets = normalTickets;
       computeTotalCost();
   }

   public double getTotalCost() {
       return totalCost;
   }

   public static int getTickets() {
       return tickets;
   }

   public static int getNumCustomers() {
       return numCustomers;
   }

   public boolean equals(Customer otherCustomer) {
       if (customerID == otherCustomer.getCustomerID() && firstName.equals(otherCustomer.getFirstName())
               && lastName.equals(otherCustomer.getLastName()))
           return true;
       return false;
   }

   public void computeTotalCost() {
       totalCost = matineeTickets * MATINEE_TICKET_COST + normalTickets * NORMAL_TICKET_COST;
   }

   public Customer hasMore(Customer otherCustomer) {
       if ((matineeTickets + normalTickets) > (otherCustomer.getMatineeTickets() + otherCustomer.getNormalTickets()))
           return this;
       else if ((matineeTickets + normalTickets) < (otherCustomer.getMatineeTickets()
               + otherCustomer.getNormalTickets()))
           return otherCustomer;
       else {
           if (customerID < otherCustomer.getCustomerID())
               return this;
           return otherCustomer;
       }
   }

   public String toString() {
       return \"First name: \" + firstName + \"\ \" + \"Last name: \" + lastName + \"\ \" + \"Customer ID: \" + customerID + \"\ \"
               + \"Number of Matinee Ticket(s): \" + matineeTickets + \"\ \" + \"Number of Normal Ticket(s): \"
               + normalTickets + \"\ \" + \"Total Cost: $\" + totalCost;
   }

}

The last two photos are assignment6.java, please help me to follow the sample out to solve this java work! Thank you very much! any of the following methods, po
The last two photos are assignment6.java, please help me to follow the sample out to solve this java work! Thank you very much! any of the following methods, po
The last two photos are assignment6.java, please help me to follow the sample out to solve this java work! Thank you very much! any of the following methods, po

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site