Answer to Question #280502 in Java | JSP | JSF for Debby

Question #280502

You have been tasked to create a class called Abaaneke, your class should contain four private variables (customerName , deposit, oldBalance, newBalace) using the appropriate data types.



Your class should also have a method that takes three arguments – name of account holder, amount deposited and old balance. The method should add the deposit to the oldBalance and call it new balance.



Using the right setters and getters, initialize the private variables and call the method to display the following



a. Account holders name



b. Amount deposited



c. Old balance



d. And new balance



The user should be able to repeat the running of the program as many as he/she wishes


(Kindly write a full Java program)

1
Expert's answer
2021-12-17T06:52:26-0500
public class Abaaneke {
    private String customerName;
    private double deposit;
    private double oldBalance;
    private double newBalance;

    public void transaction(String name, double amountDeposited, double oldBalance) {
        newBalance = oldBalance + amountDeposited;
    }

    public String getCustomerName() {
        return customerName;
    }

    public void setCustomerName(String customerName) {
        this.customerName = customerName;
    }

    public double getDeposit() {
        return deposit;
    }

    public void setDeposit(double deposit) {
        this.deposit = deposit;
    }

    public double getOldBalance() {
        return oldBalance;
    }

    public void setOldBalance(double oldBalance) {
        this.oldBalance = oldBalance;
    }

    public double getNewBalance() {
        return newBalance;
    }

    public void setNewBalance(double newBalance) {
        this.newBalance = newBalance;
    }

    @Override
    public String toString() {
        return customerName  + " " + deposit + " " + oldBalance + " " + newBalance;
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog