public class naming
{
private String name ;
private String address ;
private int idCard ;
private int firstMoney;
public naming()
{
name="";
address="";
idCard=0;
firstMoney=0;
}
public naming(String n , String ad ,int id , int fm )
{
name=n;
address=ad;
idCard=id;
firstMoney=fm;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getIdCard() {
return idCard;
}
public void setIdCard(int idCard) {
this.idCard = idCard;
}
public int getFirstMoney() {
return firstMoney;
}
public void setFirstMoney(int firstMoney) {
this.firstMoney = firstMoney;
}
}
public class deposit extends naming
{
private int depositMoney;
public deposit(int depositMoney) {
super();
this.depositMoney = depositMoney;
}
public int getDepositMoney() {
return depositMoney;
}
public void setDepositMoney(int depositMoney) {
this.depositMoney = depositMoney;
}
}
public class withdraw extends naming
{
private int withdrawMoney;
public withdraw(int withdrawMoney) {
super();
this.withdrawMoney = withdrawMoney;
}
public int getWithdrawMoney() {
return withdrawMoney;
}
public void setWithdrawMoney(int withdrawMoney) {
this.withdrawMoney = withdrawMoney;
}
}
public class admin
{
private static String userName="ali";
private static String Password="ali";
private String Login;
private String Pass;
public admin(String login, String pass) {
Login = login;
Pass = pass;
}
public static String getUserName() {
return userName;
}
public static String getPassword() {
return Password;
}
public String getLogin() {
return Login;
}
public String getPass() {
return Pass;
}
}
import java.util.Scanner;
public class banking
{
public static String getLogin()
{
Scanner input = new Scanner(System.in);
System.out.println("enter the username");
return input.nextLine();
}
public static String getPass()
{
Scanner input = new Scanner (System.in);
System.out.println("enter the password");
return input.nextLine();
}
}
import java.util.Scanner ;
public class Menu
{
public static void show()
{
System.out.println("**********************************");
System.out.println("**********BANKING SYSTEM**********");
System.out.println("**********************************");
System.out.println("1 : ADMIN");
System.out.println("2 : DEPOSIT");
System.out.println("3 : Withdraw");
}
public static void adminShow()
{
System.out.println("1 : New Account");
System.out.println("2 : Show Accounts");
}
public static String getName()
{
Scanner input = new Scanner (System.in);
System.out.println("enter your name ");
return input.nextLine();
}
public static String getAddress()
{
Scanner input = new Scanner (System.in);
System.out.println("enter your address ");
return input.nextLine();
}
public static int getIdCard()
{
Scanner input = new Scanner (System.in);
System.out.println("enter your id card number ");
return input.nextInt();
}
public static int getFirstMoney()
{
Scanner input = new Scanner (System.in);
System.out.println("enter your first money ");
return input.nextInt();
}
public static int getDepositMoney()
{
Scanner input = new Scanner (System.in);
System.out.println("enter your deposti money ");
return input.nextInt();
}
public static int getWithdrawMoney()
{
Scanner input = new Scanner (System.in);
System.out.println("enter your withdraw money ");
return input.nextInt();
}
public static void viewDetails(naming i)
{
System.out.println("NAME :" + i.getName());
System.out.println("ADDRESS :" + i.getAddress());
System.out.println("ID card # :" + i.getIdCard());
System.out.println("First time Money : " + i.getFirstMoney());
}
}
import java.util.Scanner;
public class Whole {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int choice = 0;
int choice1 = 0;
int index = 0;
int accountNo = 0 ;
naming[] accounts = new naming[10];
Scanner input = new Scanner(System.in);
Menu m = new Menu();
m.show();
System.out.println("enter your choice");
choice = input.nextInt();
switch (choice) {
case 1: {
if (banking.getLogin().equals(admin.getUserName())
&& banking.getPass().equals(admin.getPassword())) {
m.adminShow();
System.out.println("enter your choice");
choice1 = input.nextInt();
switch (choice1) {
case 1: {
if (index < 10) {
accounts[index] = new naming(Menu.getName(),
Menu.getAddress(), Menu.getIdCard(),
Menu.getFirstMoney());
index++;
} else {
System.out.println("full");
}
m.adminShow();
System.out.println("enter your choice");
choice1 = input.nextInt();
}
case 2: {
if (index > 0) {
for (int i = 0; i < index; i++) {
Menu.viewDetails(accounts[i]);
System.out.println("\n accounts # " + (i + 0));
System.out.println("------------------------");
}
System.out.println("------------------------");
} else {
System.out.println("No Car Found!");
}
}
}
}
}
case 2 :
{ System.out.println("enter your account number");
accountNo = input.nextInt();
index = accountNo ;
accounts[index]= new deposit (Menu.getDepositMoney());
here i dont know how to update the firstmoney by adding the deposit money and displaying it ???
}
}
}
}