Answer to Question #279749 in Java | JSP | JSF for Peter Lover

Question #279749

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


1
Expert's answer
2021-12-15T02:09:46-0500


package abaaneke;




public class Abaaneke {


    private double  deposit, oldBalance, newBalace;
    private String customerName ;
    
    void details(String name, double de, double old){
        deposit = de;
        oldBalance = old;
        customerName = name;
        newBalace = deposit + oldBalance;
        
        System.out.printf("Customer Name:"
                + " %s\nAmount deposited: %f\n Old balance:"
                + " %f\nNew balance %f ", customerName, deposit,oldBalance,newBalace);
    }
    
    void setCustomerName (String n){
        customerName = n;
    }
    
    void setDeposit (double n){
        deposit = n;
    }
    
    void setOldBalance (double n){
        oldBalance = n;
    }
    
    double getOld(){
        return oldBalance;
    }
    double getNew(){
        return newBalace;
    }
    double getDeposit(){
        return oldBalance;
    }
    String getName(){
        return customerName;
    }
    public static void main(String[] args) {
       Abaaneke a = new Abaaneke();
    }
    
}

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