Saturday, May 18, 2013

java Assignment 02

//=============SavingsAccount=======================

import java.util.Scanner;


public class SavingsAccount {

    private static double annualInterestRate = 0;
    private double savingsBalance;
    private int accountNumber;
    private String name;
    private String address;

    public int getAccountNumber() {
        return accountNumber;
    }

    public String getAddress() {
        return address;
    }

    public String getName() {
        return name;
    }
   

   

    public void addMonthlyInterest() {
        double thisMonthInterest = (annualInterestRate * savingsBalance) / (12*100);
        savingsBalance += thisMonthInterest;
    }

    static void modifyInterestRate() {
        System.out.println("Enter new annual interest rate:");
        annualInterestRate = (new Scanner(System.in)).nextInt();
    }

    public void setSavingsBalance(double amount) {
        this.savingsBalance = amount;
    }

  

    public double getSavingsBalance() {
        return savingsBalance;
    }
   
    public static double getAnnualInterestRate() {
        return annualInterestRate;
    }

  
   
    public SavingsAccount() {
//        createAcccount();
    }
   
    public void createAcccount(){
        System.out.println("\n>>>>>>>>>>> New Account details");
        System.out.print("\tAccount Number:");
        accountNumber = (new Scanner(System.in)).nextInt();

        System.out.print("\tName:");
        name = (new Scanner(System.in)).nextLine();

        System.out.print("\tAddress:");
        address = (new Scanner(System.in)).nextLine();

        System.out.print("\tInitial Savings Amount:");
        savingsBalance = (new Scanner(System.in)).nextDouble();
    }
   
    public void deposit(){
        System.out.println("Add deposite amount:");
        double amount=(new Scanner(System.in)).nextDouble();
        savingsBalance+=amount;
    }
   
    public void withdrawel(){
        System.out.println("Add withdrawel amount:");
        double amount=(new Scanner(System.in)).nextDouble();
        if (savingsBalance<amount){
            System.out.println("You have not enough balance in your account [balance= "+getSavingsBalance()+"]");
        }else{
            savingsBalance-=amount;
            System.out.println("Your money transaction was successfully");
        }
       
    }
   
     public void displayAccountDetails() {
        System.out.println("\n* * * * * * * * * * * * Bank Statment* * * * * * * * * * * * * * * * * * * *");
        System.out.println("\tName: " + getName() + "[ Account No: " + getAccountNumber() + "]");
        System.out.println("\tAddress: " + getAddress());
        System.out.printf("\tBalance: %8.2f", getSavingsBalance());
        System.out.println("\t" + "Current Interest rate: " + getAnnualInterestRate());
        System.out.println("* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *");

    }
   
   
   
   
}
//=============SavingsAccountTest=======================


import java.util.Scanner;


public class SavingsAccountTest {
    static int menuOption;
  
    public static void main(String[] args) {
       
         displayMainMenu();
       
         SavingsAccount saver=new SavingsAccount();
       
         do{
             if(menuOption==1){
                 saver.createAcccount();
             }else if(menuOption==2){
                 saver.deposit();
             }else if(menuOption==3){
                 saver.withdrawel();
             }else if(menuOption==4){
                 saver.displayAccountDetails();
             }else if(menuOption==5){
                 saver.modifyInterestRate();
             }else if(menuOption==6){
                saver.addMonthlyInterest();
             }
           
             displayMainMenu();
           
         }while(menuOption!=7);
       
       
     }
   
      public static void displayMainMenu() {
        System.out.println("\n========================== Main Menu ===============================================");
        System.out.println("\t 1- New Account");
        System.out.println("\t 2- Deposite");
        System.out.println("\t 3- Widdrawel");
         System.out.println("\t 4- Bank Statment");
        System.out.println("\t 5- Change Annual Interest Rate");
        System.out.println("\t 6- Add month interest to a Account");
        System.out.println("\t 7-exit ");
        System.out.println("====================================================================================\n");
        System.out.print("Choose :");
        menuOption=(new Scanner(System.in)).nextInt();
    }
  
}

  To configure Nginx for a Laravel application located within a subfolder, a  location  block is required to handle requests to that specifi...