GIDForums  

Go Back   GIDForums > Computer Programming Forums > Java Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 22-Jan-2007, 07:58
raslou raslou is offline
New Member
 
Join Date: Mar 2006
Posts: 12
raslou is on a distinguished road

Need Help with my program


A bank offers its customers four types of account:

Current account
Standard saving account
Fixed-term saving account with higher rate of interest
An offshore account

The interest rate for these accounts is:

1.5% per year on current account
6% per year on the standard saving account
7% per year of fixed term account
8% per year for an offshore account

For each customer we need:

Name
Address
Telephone no.
Account number
Type of account
Tax code

Some of the required standard operations are:

Create an account,
Deposit money into an account
Withdraw money from an account,
etc.

Design, write and test a program that:

1. Identifies the account that earns minimum interest in a year.
2. Identify the account that earns maximum interest in a year.
3. Given a customer name and balance projects the amount of interest to be paid to that account in a year.
4. Calculates the total amount of the interest that a bank needs to pay out to all its customers at the end of a year.

If time permits, you may explore the concurrent feature of this problem.






Solution
JAVA Code:
import glos.*;
import java.awt.*;
import javax.swing.*;

public class Bank extends JPanel {
    protected final static  String names [] = {" Account Customer", " Name ", "Address ",
	 " Telephone Number"," Account number ", " Type of account ", " Tax code ", " Balance ",
	 "Transaction Amount" };
public void  final int ( ACCOUNT CUSTOMER = 0, NAME = 1, ADDRESS = 2, TELEPHONE NUMBER. = 3,
	 ACCOUNT NUMBER = 4, TYPE OF ACCOUNT = 5, TAX CODE = 6, BALANCE = 7, TRANSACTION = 8);
	
public BankUI()
{
	this (8);
}
	public BankUI ( int mySize )
{
	size = mySize;
	labels = new JLabel[ size ];
	fields = new JTextField[ size ];

	for ( int i = 0; i < labels.length; i++ )
	fields[ i ] = new JTextField();

	innerPanelCenter = new JPanel();
	innerPanelCenter. setLayout( new GridLayout ( size, 2 ));

	for ( int i = 0; i< size; i++ ){
		innerPanelCenter.add ( labels[ i ] );
		innerPanelCenter.add ( fields[ i ] );
		}
		
		doTask = new JButton();
		doTask8 = new JButton();
		innerPanelSouth = new JPanel();
		innerPanelSouth.add( doTask8);
		innerPanelSouth.add( doTask);

		setLayout( new BorderLayout() );
		add( innerPanelCenter, BorderLayout.CENTER );
		add( innerPanelSouth, BorderLayout.SOUTH );
		validate();
	}
	public JButton getDoTask() { return doTask;}
	public JButton getDoTask8() { return doTask8;}
	public JTextField[] getFileds() { return fields;}

	public void clearFields()
	{
		for ( int i = 0; i < size; i++ )
			fields[ i ].setText( " " );
	}
	public void setFieldValues( String s[] )
	throws IllegalArgumentException
	{
	if ( s.length != size )
	throw new IllegalArgumentException
	{
	if ( s.length !=size )
	throw new IllegalArgumentException( "There must be " + size + " Strings in the array" );

	for ( int i = 0; i < size; i++ )
		fields [i].setText ( s [i] );
	}
	public String[] getFieldValues()
	{
	   String values[] = new String [ size ];
	for ( int i = 0; i< size; i++ );
		fields[ i ].setText( s[i].getText();
	return values;
	}
}

import java.io.Serializable;
public class BankAccountRecord implements Serializable {
	private int account customer;
	private int name;
	private int address;
	private int telephone number.;
	private int account number;
	private int type of account;
	private int tax code;
	private int balance;
	
public BankAccountRecord();
{
	this ( 0, '' '', '' '', 0, 0, '' '', 0, 0.0 );
}

public BankAccountRecord( int account cust, String name, String address, int telephone no., int acct no., String type of acct, int tax code, double bal )
{

	setAccountCustomer ( account cust );
	setName ( name );
	setAddres ( address );
	setTelephoneNumber ( telephone no. );
	setAccountNumber ( acct no. );
	setTypeOfAccount ( type of acct );
	setTaxCode ( tax code );
	setBalace ( bal );
}
	public  void setAccountCustomer ( int account cust )
{
	accountCustomer = account cust;
}
	public int getAccount() { return account customer; }
	
	public String getName() { return name;}
	{
	name = name;
	}
	public void setName ( String name }
	{
	public String getAddress() { return address; }
	{
	address = address;
	}	
	public void setAddress ( String address )

	public void setTelephoneNumber ( int telephone no. )
	{
	telephone number = telephone no.;
	}	 
	public int getTelephoneNumber() { return Telephone number;}

	public void setAccountNumber ( int acct no. )
	{
	    accountNumber = acctNo.;
	{
	public int getAccountNumber () { return account number }

	public void setTypeOfAccount ( String TypeOfAcct	)
	{
		typeOfAccount = tyopeOfAcct;
	}
	public String getTypeOfAccount (){ return typeOfAccount }
	
	public void setTaxCode ( int taxCode )
	{
		taxCode = taxCode;
	}
	public int getTaxCode ( ){ return taxCode }

	public void setBalance ( double bal )
	{
		balance = bal;
	}
	public double getBalance(){ return balance;}
	}

    
}       
}
Last edited by LuciWiz : 22-Jan-2007 at 08:37. Reason: Please insert your Java code between [java] & [/java] tags
  #2  
Old 22-Jan-2007, 09:43
TurboPT's Avatar
TurboPT TurboPT is offline
Senior Member
 
Join Date: Feb 2006
Location: Atlanta, GA
Posts: 1,233
TurboPT is a jewel in the roughTurboPT is a jewel in the roughTurboPT is a jewel in the rough

Re: Need Help with my program


So... what help do you need, or what is wrong?
It appears that you've only provided what the program needs, with a skeleton program.
__________________
Use the force...read the source!!
WYCIWYG -- what you code is what you get!
 
 

Recent GIDBlogInstall Adobe Flash - Without Administrator Rights by LocalTech

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Text-Based Roulette Game mfm1983 C++ Forum 5 29-Nov-2006 12:20
BOOKEEPING program, HELP!! yabud C Programming Language 10 17-Nov-2006 03:48
Pipeline freeze simulation darklightred C++ Forum 6 27-Jul-2006 19:37
How to read particular memory location ? realnapster C Programming Language 10 10-May-2006 09:11
Type casts ? kai85 C++ Forum 12 23-Jun-2005 12:04

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 02:40.


vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.