Skip to content

Commit

Permalink
Java Training Person Class
Browse files Browse the repository at this point in the history
  • Loading branch information
Pankaj-Leo committed Mar 8, 2023
1 parent 6ca44fd commit 965838b
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions Constructor/Account.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
package Constructor;
public class Account {

private String number;
private double balance;
private String customerName;
private String customerEmail;
private String customerPhone;

public Account() {
System.out.println("Empty constructor called");
}

public Account(String number, double balance, String customerName, String email,
String phone) {
System.out.println("Account constructor with parameters called");
this.number = number;
this.balance = balance;
this.customerName = customerName;
customerEmail = email;
customerPhone = phone;
}

public void depositFunds(double depositAmount) {

balance += depositAmount;
System.out.println("Deposit of $" + depositAmount + " made. New balance is $" +
balance);
}

public void withdrawFunds(double withdrawalAmount) {

if (balance - withdrawalAmount < 0) {
System.out.println("Insufficient Funds! You only have $" + balance +
" in your account.");
} else {
balance -= withdrawalAmount;
System.out.println("Withdrawal of $" + withdrawalAmount +
" processed, Remaining balance = $" + balance);
}
}

public String getNumber() {
return number;
}

public void setNumber(String number) {
this.number = number;
}

public double getBalance() {
return balance;
}

public void setBalance(double balance) {
this.balance = balance;
}

public String getCustomerName() {
return customerName;
}

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

public String getCustomerEmail() {
return customerEmail;
}

public void setCustomerEmail(String customerEmail) {
this.customerEmail = customerEmail;
}

public String getCustomerPhone() {
return customerPhone;
}

public void setCustomerPhone(String customerPhone) {
this.customerPhone = customerPhone;
}
}

0 comments on commit 965838b

Please sign in to comment.