Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Please someone write this code, im really lost and overwhelmed by this class (Th

ID: 673460 • Letter: P

Question

Please someone write this code, im really lost and overwhelmed by this class (This is java class)

Problem 2

You will create a Customer class. This class could be useful to a plumber or a dentist, or for that matter, any company that needs to track its customers.

Data Fields: • id (assigned automatically) • name • address • phone • email • beginDate • endDate

Constructors: The id is an int that is assigned automatically starting from 100. There should be a static variable named lastId, which is incremented each time a constructor is called. A constructor increments lastId and uses that value for id. Create at least two constructors, the default constructor (no arguments) asks the user to enter values for the fields except for id. There should also be a constructor with parameters for every field except id.

Methods: • Getters (accessors) and setters (mutators) for each field. (No setter for id) • sendMsg (String message) – sends an email message to the customer

Testing the Customer class: Write a program to test your Customer class definition.

Explanation / Answer

import java.util.Scanner;

public class Test {

   public static void main(String[] args){
   Customer c1=new Customer();
   Customer c2=new Customer("mike", "Miami", "2345678910", "abc@xyz.com", "1/2/3", "3/4/5");
   System.out.println("Id of first customer: "+c1.getId());
   System.out.println("Id of second customer: "+c2.getId());
   System.out.println("Enter the message you want to send to customer 1: ");
   Scanner scan=new Scanner(System.in);
   String message=scan.nextLine();
   c1.sendMsg(message);
   }

  

}

import java.util.Scanner;

public class Customer{
int id;
String name;
String address;
String phone;
String email;
String beginDate;
String endDate;
static int lastId=100;
public Customer(){
   Scanner s=new Scanner(System.in);
   System.out.print("Enter your name: ");
   name=s.nextLine();
   System.out.print("Enter your address: ");
   address=s.nextLine();
   System.out.print("Enter your phone: ");
   phone=s.nextLine();
   System.out.print("Enter your email: ");
   email=s.nextLine();
   System.out.print("Enter your begin date: ");
   beginDate=s.nextLine();
   System.out.print("Enter your end date: ");
   endDate=s.nextLine();
   id=lastId;
   lastId++;
}
public Customer(String n,String a,String p,String e,String b,String end){
     
  
   name=n;
  
   address=a;
  
   phone=p;
  
   email=e;
  
   beginDate=b;
  
   endDate=end;
   id=lastId;
   lastId++;
}
public void sendMsg(String message){
   System.out.println("Your Message: "+message+" was sent to email "+this.email);
}
public void setName(String n){
   this.name=n;
}
public void setId(int n){
   this.id=n;
}
public void setAddress(String n){
   this.address=n;
}
public void setPhone(String n){
   this.phone=n;
}
public void setEmail(String n){
   this.email=n;
}
public void setBeginD(String n){
   this.beginDate=n;
}
public void setEndD(String n){
   this.endDate=n;
}
public String getName(){
   return this.name;
}
public int getId(){
   return this.id;
}
public String getAddress(){
   return this.address;
}
public String getPhone(){
   return this.phone;
}
public String getEmail(){
   return this.email;
}
public String getBeginD(){
   return this.beginDate;
}
public String getEndD(){
   return this.endDate;
}
}