Ask DOT NET Expert

Create account management with java gui using a MVC model.create withdraw, create account, deposit , trasfer , balance , on the main fram. and On pressing one of these buttons a window "Start deposit/withdraw for ac count: account ID suppose to show up. The accountI D should correspond to the account selected in the drop-down list of the main window when a "Create ... agent" button was pressed. " " agent window contains some editable textfield( id, amount in, operations per second On pressing per second" initialized to 0.0, it accepts only digits and a decimal point


Pleasecheck code and then fix my code, i'm kind of lost.

Model

package model;
import java.util.Scanner;

/** using MVC model to create a account management program */
/** Design Model class*/
/** A model is an object representing data or even activity*/


public class AccountModel {

   private final double euro = 0.72; /** set variables*/
   private final double yuan = 6.2;
   private String id;
   private String name;
   private double balance;


   public AccountModel(String id, String name, double balance) {
   super(); /**constructs a new instance of a this class*/
   this.id = id; /** design methods for managing account*/
   this.name = name;
   this.balance = balance; /** original amount of usd money*/
   }

   public String getId() { /** set and getting ID*/
   return id;   
   }

   public void setId(String id) {
   this.id = id;
   }

   public String getName() {
   return name; /** set and getting Name*/
   }

   public void setName(String name) {
   this.name = name;
   }

   public double deposit(double amount)
   { /** design deposit method*/
       System.out.print("Enter the amount of deposit:\n");

       Scanner SC = new Scanner(System.in);
       amount=SC.nextDouble();
   try{ balance= balance+amount;
   } catch(Exception e){};
   /** using exception for prevent runtime error*/
   return balance;
   }
   public double withdraw(double amount)
   {
       System.out.print("Enter the amount of withdraw:\n");
Scanner SC = new Scanner(System.in);
           amount=SC.nextDouble(); /** design withdraw method*/
           try{
       balance= balance-amount;
           } catch(Exception e){};
           return balance;
   }
   public double editin_euro()
   { try{ /** translate usd to Euro*/
   balance = balance * euro;}
   catch(Exception e){};
   return balance;
  
   }
   public double editin_yuan()
   {
   try{ /** translate usd to yuan*/
       balance = balance / yuan;
   } catch(Exception e){};
   return balance;
   }
   public double getBalance()
   {
   return balance;
   }
  
      
     
}

view

package model;

import java.util.Scanner;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/** design view class, represents the visualization of the data that model contains*/

public class AccountView extends JFrame {

      
     
       AccountView(){
       setTitle("Bank managemet system");
       setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       setLayout(new BorderLayout());
       add(new JButton("createAccount"),BorderLayout.CENTER);
       add(new JButton("deposit"), BorderLayout.NORTH);
       add(new JButton("withdraw"), BorderLayout.SOUTH);
       add(new JButton("transfer"), BorderLayout.EAST);
       add(new JButton("balance"), BorderLayout.WEST);
       setSize(300,200);
       setVisible(true);
       JButton btn= new JButton("deposit");
       Action_Listner listener= new Action_Listner();
       btn.addActionListener(listener);
       add(btn);
       }
      
       public static void main(String[] args)
       {
           new AccountView();
       }
      
       public void Accountview(String name,String id, Double money) {
              System.out.println("Name: " + name);
              System.out.println("ID: "+ id); /** Main informations for print out on screen*/
              System.out.println("Balance: " + money);
              }
             
      
}

Control

package model;
/**design controller class that for acting on both model and view.
* it controls the data flow into model object and updates the view
* where ever data changes. it keeps view and model seperates
*
*
*/
public class AccountController {
   private AccountModel model; /** call model and view */
   private AccountView view;
  
   public AccountController(AccountModel model, AccountView view) {
   this.model = model;
   this.view = view; /**controllthe data flow bot model and view */
   }
  
   public void setaccountName(String name) {
   model.setName(name);
   }
  
   public String getaccountName() {
   return model.getName();
   }
  
   public void setaccountid(String id) {
   model.setId(id);
   }
  
   public String id() {
   return model.getId();
   }
   public Double balance()
   {
   return model.getBalance();
   }
   public void updateView() { /** updates the view information when it is changes*/
   view.Accountview(model.getName(), model.getId(),model.getBalance());
   }
   }

DOT NET, Programming

  • Category:- DOT NET
  • Reference No.:- M9455218

Have any Question?


Related Questions in DOT NET

Assignment specificationthis assignment is split into two

ASSIGNMENT SPECIFICATION This assignment is split into two documents. 1. Assignment Specification. This document contains the specification for what you will be required to do. 2. Assignment Addendum. This document conta ...

Scenariouser modelling inc would like to organize a series

Scenario User Modelling Inc. would like to organize a series of conferences focusing on research topics in the area of user adaptive systems and personalization. They need to organize annual conferences for researchers a ...

Casewe sell pdfs from our site and pdfs can be ordered from

Case We sell pdf''s from our site and pdfs can be ordered from the site by selecting a book, putting it in a shopping cart, then signing in with a password or as a guest, and then checking out. For some reason, when a pu ...

Summarythis assessment requires you to develop a simple

Summary This assessment requires you to develop a simple text editor with a basic offline user login. It is a windows application that will allow new uses to be added, existing users to login, and to create/save/edit tex ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As