// ----------------------------------------CASE Study sa JAVA---------------------------------------------------import [Link].*; import [Link].
*; public class AutoTellerMachine { public static void main (String[] args)throws Exception { //declaration String start,strbal,strexit,stradmin; char chTransac,chBal,chExodus,chadmstr; int intPin,intEdit,intChange,intExtra=20; double dblWithdraw,dblDeposit; //df format in money DecimalFormat df = new DecimalFormat("0.00"); BufferedReader br = new BufferedReader(new InputStreamReader([Link])); // Arrays String acctnos[] = {"0123-4567-8901", "2345-6789-0123", "3456-7890-1234", "4567-89012345", "5678-9012-3456"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "}; String acctname[] = {"Roel Richard\t", "Dorie Marie\t\t", "Railee Darrel\t", "Railynne Desiree", "Raine Desiree\t"," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "," "}; double dblBal[] = { 5000.00, 0.00, 10000, 2500, 10000,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; int arrPins[] = {1111, 2222, 3333, 4444, 5555,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; //Texts shortcut Messages RGBC= new Messages (); Messages output1= new Messages(); Messages output3= new Messages(); Messages output4= new Messages(); Messages adminchoice= new Messages(); Messages info= new Messages(); Messages exiting= new Messages(); Messages actnumber= new Messages(); Messages actname= new Messages(); Messages actpin= new Messages(); Messages labas= new Messages(); [Link]("\t\t\tRGBC\n Richard Gwapo Banking Corporation\n_________________________________\n\n"); [Link]("\t\t\tRGBC\n Richard Gwapo Banking Corporation\n__________________________________\n\n S- Start Application\n Q-Quit Application\n\nEnter Choice:"); [Link]("\t\t\tRGBC\n Richard Gwapo Banking Corporation\n___________________________________\n\nEnter your pin number:");
[Link]("\t\t\tRGBC\n Richard Gwapo Banking Corporation\n____________________________________\nSelect Type of Transaction\nB -> Balance Inquiry\nW -> Withdrawal\nD -> Deposit\nC -> Cancel\n\nEnter your transaction: "); [Link]("\nWhat would you like to do?\n\n(V)-View Customer Information\n(A)-Add New Customer\n(E)-Edit Customer Information\n(C)-Change Customer Pin Number\n(X)-Exit\n\nEnter your choice: "); [Link]("\nAccount Number\tAccount Name\t\tPin Number\tBalance"); [Link]("\nPress x to continue..."); [Link]("\nAccount Number of the customer: "); [Link]("\nName of the customer:"); [Link]("Customer PIN Number:"); [Link]("Press X to exit"); //output 1 loop aaa: for (int user = 0, counter=1; user < counter; user++) { [Link] ([Link]()); start = [Link](); counter++; chTransac = [Link](0); //if 'S' is inputted switch(chTransac) { case 'S': case 's': //password input is limited to three for(int pincount = 0; pincount < 3; pincount++) { [Link] ([Link]()); intPin = [Link]([Link]()); bbb: for(int pincheck = 0; pincheck<intPin+1; pincheck++) { if (intPin==0) { [Link] ([Link]()+[Link]()); stradmin = [Link](); chadmstr = [Link](0); switch(chadmstr) { // if v is inputted view all customers case 'V':
case 'v': [Link] ([Link]()); for(int acctindex = 0; acctindex < [Link]-intExtra; acctindex++) { [Link] (acctnos[acctindex]+"\t"+acctname[acctindex]+"\t"+arrPins[acctindex]+"\t\t"+[Link](dblBal[ acctindex])); } [Link]([Link]()); strexit = [Link](); chExodus = [Link](0); if(chExodus == 'x'||chExodus == 'X') continue bbb; // if a is inputted add new customer case 'A': case 'a': [Link] ([Link]()); acctnos[[Link] - intExtra] = [Link](); [Link] ([Link]()); acctname[[Link] - intExtra] = [Link](); [Link] ([Link]()); arrPins[[Link] - intExtra] = [Link]([Link]()); dblBal[[Link] - intExtra] = 0.0; intExtra--; [Link] ([Link]()); strexit = [Link](); chExodus = [Link](0); if(chExodus == 'X'||chExodus == 'x') continue bbb; //if e is inputted, edit customers case 'E': case 'e': [Link] ("\nInput customer's Pin: "); intEdit = [Link]([Link]()); for(int acctnew = 0; acctnew < [Link]-intExtra; acctnew++) { if(intEdit == arrPins[acctnew]) { [Link] ("\nInput customer's new Account Name: ");
acctname[acctnew] = [Link](); [Link] ("\nInput customer's new Account Number: "); acctnos[acctnew] = [Link](); } } [Link] ([Link]()); strexit = [Link](); chExodus = [Link](0); if(chExodus == 'X'||chExodus == 'x') continue bbb; // if c is inputted change password case 'C': case 'c': [Link] ("\nInput customer's Pin: "); intChange = [Link]([Link]()); for(int acctnew = 0; acctnew < [Link]-intExtra; acctnew++) { if(intChange == arrPins[acctnew]) { [Link] ("\nInput customer's new Pin: "); arrPins[acctnew] = [Link]([Link]()); } } [Link] ([Link]()); strexit = [Link](); chExodus = [Link](0); if(chExodus == 'X'||chExodus == 'x') continue bbb; //if x is inputted go back to output1 loop case 'X': case 'x': continue aaa; } } ccc: //output for regular customer //password limited to three for (int customerpincheck = 0; customerpincheck < intPin; customerpincheck++)
{ // check if pin is in the list for(int index = 0; index < [Link]-intExtra ;index++) { if(intPin==arrPins[index]) { [Link] ([Link]()); strbal = [Link](); chBal = [Link] (0); switch(chBal) { //balance function case 'B': case 'b': [Link] ([Link]()+"\nAccount #:"+acctnos[index]+"\nAccount Name:"+acctname[index]+"\nBalance: "+dblBal[index]+"\n\n"+[Link]()); strexit = [Link](); chExodus = [Link](0); if(chExodus == 'X'||chExodus == 'x') continue ccc; // withrawal function case 'W': case 'w': [Link] ([Link]()+"\nEnter Amount to be withdrawn\t\t"); dblWithdraw = [Link]([Link]()); if((dblWithdraw >=100)&&((dblWithdraw/50)%2 == 0)&&(dblWithdraw!=0.0)) {dblBal[index]-= dblWithdraw; [Link] ([Link]()); strexit = [Link](); chExodus = [Link](0); if(chExodus == 'X'||chExodus == 'x') continue ccc; } else //if invalid input of withdraw {[Link] ("* Valid amount: 100, 200, 1700... etc(100 denominations)\n* Invalid amount: 450, 10, 1000.25... etc"); [Link] ([Link]()); strexit = [Link](); chExodus = [Link](0);
continue ccc;}
case 'D': case 'd': //deposit function [Link] ([Link]()+"\nEnter Amount to be deposited\t\t"); dblDeposit = [Link]([Link]()); dblBal[index]+=dblDeposit; [Link] ([Link]()); strexit = [Link](); chExodus = [Link](0); continue ccc; //if cancel, go to output1 loop case 'C': case 'c': continue aaa; // if inputted letter is not on the list default: [Link] ("\n\nPlease Input the Correct Letter!\n"); continue ccc; } } } //if inputting password reached 3 if(pincount == 2) { pincheck+=1000000; customerpincheck+=100000; [Link] ("\n\nCAPTURED CARD!!! PLEASE CALL 143-44");} // if wrong password else { pincheck+=1000000; customerpincheck+=1000000; [Link] ("\n\nInput the correct pin number!");} } } } // if Q is inputted
case 'Q': case 'q': [Link](0); //if wrong letter is inputted default: [Link] ("\n\nPlease Input Correct Letter!\n"); } } } }
CLASS MESSAGES public class Messages { public String title; public String getTitle(){ return title; } public void setTitle(String labels){ title = labels; } }
UNIVERSITY OF MAKATI J.P. Rizal Ext., West Rembo, Makati City
Final Case Study in ITC33-OOP JAVA
Submitted by: Cacela, Arcie Q. Dela Cruz, John Chris G. Galarosa, Hernel M. Moaa, John Nikko V.
Submitted to: Mrs. Emily Franco Sicat
SAMPLE OUTPUT