1. Trang chủ
  2. » Công Nghệ Thông Tin

A Guide To Advanced Java - Introduction to Threads pptx

2 292 1
Tài liệu đã được kiểm tra trùng lặp

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 2
Dung lượng 17,96 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

In order to achieve this, the management has planned to computerize the process of transferring money from one account to another while maintaining the same total value.. The description

Trang 1

A Guide To Advanced Java Assignments

Introduction to Threads

1 United Bank is an esteemed bank that provides various banking services Its

services include receiving deposits of money, lending money and processing transactions The management of United Bank is looking at automation as a means to save time and effort required in their work In order to achieve this, the management has planned to computerize the process of transferring money from one account to another while maintaining the same total value

The United Bank Manager and a team of experts have chosen your company

to provide a solution for the same Consider yourself to be a part of the team that implements the solution for designing the application

Create an application using Threads to implement the application The application should consist of the following classes:

1 CustomerAccount.java

2 TransferManager.java

3 AccountManager.java Each file has a specific purpose and functionality The descriptions of each file are as follows:

CustomerAccount.java

The CustomerAccount class is used to store the information, such as account type and balance amount for the customer account

The CustomerAccount class contains instance variables accountType and balance to store the account type and the balance amount respectively Create a getter method named getAccountType() to retrieve the account

type of the customer Similarly, create another getter method named

getBalance() to retrieve the balance amount of the customer Further, create a setter method named setBalance() to set the balance amount of

the customer

TransferManager.java The TransferManager class demonstrates the use of Runnable interface to

transfer money from one account to another while maintaining the same total value over the two accounts

The TransferManager class contains instance variable transferCount to

store the count for the number of transfer instances that will take place

The run() method is implemented in this class and when it is invoked, it

transfers money from one account to another while maintaining the same total value over two accounts

Trang 2

A Guide To Advanced Java Assignments

AccountManager.java The AccountManager class demonstrates creation of Thread objects using

Runnable interface to display the total balance before transfer and after transfer Create two threads and initiate the execution of both the threads Display the Total balance before transfer and after transfer where both the amount should be the same

Ngày đăng: 02/08/2014, 08:21

TỪ KHÓA LIÊN QUAN