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

JAVA Hello i would like some help with this program here is my code: Customer.ja

ID: 3745307 • Letter: J

Question

JAVA

Hello i would like some help with this program

here is my code:

Customer.java

package Cust;

/

public static void main(String[] args) {
// TODO code application logic here
}
  
private String CustID;
private String CustName;
private String CustEmail;
private boolean isPreferred;
  
public Customer(){}
  
public Customer(String id, String n, String e, boolean p){
  
CustID = id;
CustName = n;
CustEmail = e;
isPreferred = p;
  
}

/**
* @return the CustID
*/
public String getCustID() {
return CustID;
}

/**
* @param CustID the CustID to set
*/
public void setCustID(String CustID) {
this.CustID = CustID;
}

/**
* @return the CustName
*/
public String getCustName() {
return CustName;
}

/**
* @param CustName the CustName to set
*/
public void setCustName(String CustName) {
this.CustName = CustName;
}

/**
* @return the CustEmail
*/
public String getCustEmail() {
return CustEmail;
}

/**
* @param CustEmail the CustEmail to set
*/
public void setCustEmail(String CustEmail) {
this.CustEmail = CustEmail;
}

/**
* @return the isPreferred
*/
public boolean isIsPreferred() {
return isPreferred;
}

/**
* @param isPreferred the isPreferred to set
*/
public void setIsPreferred(boolean isPreferred) {
this.isPreferred = isPreferred;
}
  
@Override
public String toString()
{
return String.format("%1$-8s", CustID)+
String.format("%1$-25s", CustName)+
String.format("%1$-35s", CustEmail)+
  
}

HW2: Inheritance Preferred Customer Progranm 20 Points Your Task In this program you will demonstrate the use of inheritance by coding Customer (superclass) and PreferredCustomer (subclass) classes. Additional topics include: overriding toString0, calling the superclass constructor from the subclass, use of an ArrayList to store both Customer and PreferredCustomer objects, and polymorphism. Custo Custome PreferedCiastomer Code the following two classes: Customer (superclass) and PreferredCustomer (subclass, extends Custome. See next page for detailed specs.

Explanation / Answer

//*******************************************************************

// Welcome to CompileJava!

// If you experience any issues, please contact us ('More Info') -->

// Also, sorry that the "Paste" feature no longer works! GitHub broke

// this (so we'll switch to a new provider): https://blog.github.com

// /2018-02-18-deprecation-notice-removing-anonymous-gist-creation/

//*******************************************************************

import java.util.*;

public class Customer

{

private String CustID;

private String CustName;

private String CustEmail;

private boolean isPreferred;

public Customer (String id, String n, String e, boolean p)

{

CustID = id;

CustName = n;

CustEmail = e;

isPreferred = p;

}

public Customer ()

{

}

/**

* @return the CustID

*/

public String getCustID ()

{

return CustID;

}

/**

* @param CustID the CustID to set

*/

public void setCustID (String CustID)

{

this.CustID = CustID;

}

/**

* @return the CustName

*/

public String getCustName ()

{

return CustName;

}

/**

* @param CustName the CustName to set

*/

public void setCustName (String CustName)

{

this.CustName = CustName;

}

/**

* @return the CustEmail

*/

public String getCustEmail ()

{

return CustEmail;

}

/**

* @param CustEmail the CustEmail to set

*/

public void setCustEmail (String CustEmail)

{

this.CustEmail = CustEmail;

}

/**

* @return the isPreferred

*/

public boolean isIsPreferred ()

{

return isPreferred;

}

/**

* @param isPreferred the isPreferred to set

*/

public void setIsPreferred (boolean isPreferred)

{

this.isPreferred = isPreferred;

}

@Override public String toString ()

{

return String.format ("%1$-8s", CustID) +

String.format ("%1$-25s", CustName) +

String.format ("%1$-35s", CustEmail);

}

}

public class PreferredCustomer

{

private double discountRate;

private int rewardPoints;

public PreferredCustomer ()

{

}

public PreferredCustomer (String id, String n, String e, boolean p,

double dr, int points)

{

super(id, n, e, p);

discountRate = dr;

rewardPoints = points;

}

double getDiscountRate ()

{

return discountRate;

}

void setDiscountRate (double dr)

{

discountRate = dr;

}

int getRewardPoints ()

{

return rewardPoints;

}

void setRewardPoints (int points)

{

rewardPoints = points;

}

@Override public String toString ()

{

return super.toString()+

String.format ("%1$-35s", discountRate)+

String.format ("%1$-35s", rewardPoints)

;

}

}

public class Main

{

public static void main(String[] args) {

ArrayList<Customer> allCustomers = new ArrayList<Customer>();

allCustomers.add(new Customer("1","A1","test",false));

}

}