Limited access

Upgrade to access all content for this subject

Consider the following Customer class.

public class Customer 
{
    private int custNum; 
    private String firstName;
    private String lastName;
    private String homePhone = "";
    private double totPurchaseAmt = 0;

    // other data and methods not shown
}

Which of the following methods could be coded in the Customer class so that other classes could modify the total purchase amount of a Customer?

Customer greg = new Customer(56246, "Greg", "Johnson");
greg._______________);  // change Greg’s total purchase amount
A
public double setTotPurchaseAmt(double amt)
{
    return amt;
}
B
public void setTotPurchaseAmt(double amt)
{
    totPurchaseAmt = amt;
}
C
public double setTotPurchaseAmt()
{
    return totPurchaseAmt;
}
D
public double setTotPurchaseAmt(double amt)
{
    totPurchaseAmt = amt;
}
E
public void setTotPurchaseAmt(double amt)
{
    totPurchaseAmt = amt;
    return totPurchaseAmt;
}
Select an assignment template