Package distrsys.rmi.bank.common

Examples of distrsys.rmi.bank.common.Konto


        {
          System.out.println(accountName);
          System.out.print("\t>> ");
          String name = stdin.readLine().trim();
         
          Konto konto = bank.finde(name);
          if(konto == null)
            System.out.println(noSuchAccount);
          else
            System.out.println(konto.kontostand());
        }
        else if(command.equals("withdraw"))
        {
          System.out.println(accountName);
          System.out.print("\t>> ");
          String name = stdin.readLine().trim();
         
          System.out.println(enterAmount);
          System.out.print("\t>> ");
          String amount = stdin.readLine().trim();
         
          try
          {
            Konto konto = bank.finde(name);
            if(konto == null)
              System.out.println(noSuchAccount);
            else
            {
              long amount2 = Long.parseLong(amount);
              konto.abheben(amount2);
            }
          }
          catch(NumberFormatException e)
          {
            System.out.println(wrongNumberFormat);
          } catch (BankException e) {
            System.out.println(overdrawAccount);
          }
        }
        else if(command.equals("deposit"))
        {
          System.out.println(accountName);
          System.out.print("\t>> ");
          String name = stdin.readLine().trim();
         
          System.out.println(enterAmount);
          System.out.print("\t>> ");
          String amount = stdin.readLine().trim();
         
          try
          {
            Konto konto = bank.finde(name);
            if(konto == null)
              System.out.println(noSuchAccount);
            else
            {
              long amount2 = Long.parseLong(amount);
              konto.einzahlen(amount2);
            }
          }
          catch(NumberFormatException e)
          {
            System.out.println(wrongNumberFormat);
          }
        }
        else if(command.equals("pay interest"))
        {
          bank.verzinsen();
        }
        else if(command.equals("delete"))
        {
          System.out.println(accountName);
          System.out.print("\t>> ");
          String name = stdin.readLine().trim();
         
          Konto konto = bank.finde(name);
          if(konto == null)
            System.out.println(noSuchAccount);
          else
          {
            bank.loesche(name);
View Full Code Here


      e.printStackTrace();
    }
  }

  public GiroKonto erzeuge_giro_konto(String accountNumber, long creditLimit) throws BankException, RemoteException {
    Konto konto = finde(accountNumber);
    if(konto != null)
      throw new BankException("account already exists!");
   
    GiroKonto giroKonto = new GiroKontoImpl(accountNumber, creditLimit);
    kontos.put(accountNumber, giroKonto);
View Full Code Here

   
    return giroKonto;
  }

  public SparKonto erzeuge_spar_konto(String accountNumber, float zins_satz) throws BankException, RemoteException {
    Konto konto = finde(accountNumber);
    if(konto != null)
      throw new BankException("account already exists!");
   
    SparKonto sparKonto = new SparKontoImpl(accountNumber, zins_satz);
    kontos.put(accountNumber, sparKonto);
View Full Code Here

  }
 
  public void testErzeuge_giro_konto() throws BankException, RemoteException {
    String accountNumber = "789";
    bank.erzeuge_giro_konto(accountNumber, 1000);
    Konto konto = bank.finde(accountNumber);
    assertNotNull(konto);
    assertEquals(accountNumber, konto.konto_nummer());
  }
View Full Code Here

  public void testErzeuge_spar_konto() throws BankException, RemoteException {
    float interest = 3.3f;
    String accountNumber = "123";
    bank.erzeuge_spar_konto(accountNumber, interest);
    Konto konto = bank.finde(accountNumber);
    assertNotNull(konto);
    assertEquals(accountNumber, konto.konto_nummer());
  }
View Full Code Here

    float interest = 3.2f;
    long creditLimit = 200L;
    String accountNumberGiro = "123";
    String accountNumberSpar = "456";
   
    Konto konto = bank.finde(accountNumberGiro);
    assertNull(konto);
    konto = bank.finde(accountNumberSpar);
    assertNull(konto);
    bank.erzeuge_giro_konto(accountNumberGiro, creditLimit);
    bank.erzeuge_spar_konto(accountNumberSpar, interest);
    konto = bank.finde(accountNumberGiro);
    assertNotNull(konto);
    assertEquals(accountNumberGiro, konto.konto_nummer());
    konto = bank.finde(accountNumberSpar);
    assertNotNull(konto);
    assertEquals(accountNumberSpar, konto.konto_nummer());
  }
View Full Code Here

  public void testLoesche() throws BankException, RemoteException {
    float interest = 3.3f;
    String accountNumber = "123";
    bank.erzeuge_spar_konto(accountNumber, interest);
    bank.loesche(accountNumber);
    Konto konto = bank.finde(accountNumber);
    assertNull(konto);
  }
View Full Code Here

  {
    long balance = 1000;
    float interest = 3.3f;
    String accountNumber = "123";
    bank.erzeuge_spar_konto(accountNumber, interest);
    Konto konto = bank.finde(accountNumber);
    konto.einzahlen(balance);
    assertEquals(balance, konto.kontostand());
    bank.verzinsen();
    balance += (long)(balance*interest)/100;
    assertEquals(balance, konto.kontostand());
    bank.verzinsen();
    balance += (long)(balance*interest)/100;
    assertEquals(balance, konto.kontostand());
    bank.verzinsen();
    balance += (long)(balance*interest)/100;
    assertEquals(balance, konto.kontostand());
  }
View Full Code Here

TOP

Related Classes of distrsys.rmi.bank.common.Konto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.