Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package bank;
- class Main {
- public static void main (String[] args) {
- Account account = new Account(99, "A2B32");
- }
- }
- class Bank {
- private double interestRate = 8.5;
- private double transactionFees = 10;
- private Customer [] customer;
- public void calculateInterest() {
- }
- public void getInterestRate() {
- }
- public double getTransactionFees() {
- return transactionFees;
- }
- }
- class Account {
- private double balance = 100;
- private String accountNr;
- private boolean firstTime = true;
- public Account(String acc) {
- accountNr = acc;
- }
- public Account(double bal, String acc) {
- if (balance >= 100) {
- balance = bal;
- }
- else {
- balance = 100;
- }
- accountNr = acc;
- }
- public void deposit(double howMuch) {
- if (howMuch > 0) {
- balance = balance + howMuch;
- System.out.println(howMuch + "was successfully deposited to your account.");
- }
- else{
- System.err.println("Please ensure that the amount of the deposit is not negative.");
- }
- }
- public void withdraw(double howMuch) {
- if (howMuch > 0) {
- if (firstTime == true) {
- double tempBalance = balance;
- tempBalance = tempBalance - howMuch;
- if (tempBalance>=100) {
- balance = balance - howMuch;
- }
- else {
- System.err.println("Insufficent balance to remove " + howMuch);
- }
- firstTime = false;
- }
- else {
- Bank bank = new Bank();
- double tempBalance = balance;
- tempBalance = tempBalance - howMuch - bank.getTransactionFees();
- if (tempBalance>=100) {
- balance = balance - howMuch;
- }
- else {
- System.err.println("Insufficent balance to remove " + howMuch);
- }
- }
- }
- else{
- System.err.println("Please ensure that the amount of the deposit is not negative.");
- }
- }
- public void getBalance() {
- }
- }
- class Customer {
- private String name;
- private Account account;
- public void display() {
- }
- public void getName() {
- }
- public void getAccount() {
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement