package atm.com;
/ **
* User Accounts category
* /
import java.sql. *;
public class Account {
DataOperation dto = new DataOperation ();
/ *
* Change Password Methods
* /
public int changePwd (String gId, String pwd, String oldPwd, String newPwd,
String newPwd2) {
if (newPwd.length () == 0 | | newPwd.trim (). equals (""))
return -3 ;/ / new password can not be empty
else if (oldPwd.equals (pwd)) {
if (newPwd.equals (newPwd2)) {
dto.exeSql ("update atm set pwd = '" + newPwd + "' where gId = '"
+ GId + "'");
return 1 ;/ / password changed successfully
} Else {
return -2 ;/ / twice for different
}
} Else {
return -1 ;/ / old password entered incorrectly
}
}
/ *
* Verify the user ID method
* /
public boolean checkAccount (String tId) {
String sql;
sql = "select * from atm where gId = '" + tId + "'";
if (dto.getRowcount (sql)> 0) / / legal ID
{
return true;
} Else / / illegal ID
{
return false;
}
}
/ *
* Verify Password methods
* /
public boolean checkPwd (String tId, String tpwd) {
String sql;
sql = "select * from atm where pwd = '" + tpwd + "' and gId = '" + tId
+ "'" ;
if (dto.getRowcount (sql)> 0) / / legal password
{
return true;
} Else / / illegal password
{
return false;
}
}
/ *
* This method is used to check your balance method
* /
@ SuppressWarnings ({"finally", "finally", "finally"})
public float queryBalance (String gId) {
ResultSet rs;
String sql = "select * from atm where gId = '" + gId + "'";
222222
# include <stdio.h>
# include <stdlib.h>
# include <conio.h>
main ()
{
????????int password, sccs = 0;
????????int xuanze, jine;
????????printf ("\ n --- *** This is an ATM machine withdrawals program *** --- \ n");
????????getch ();
????????system ("cls");
????????printf ("Please enter the password : " ) ;
????????scanf ("% d", & password);
????????if (password! = 123456)
????????{
????????????????while (sccs <2)
????????????????????????{
???????????????????????????sccs + +;
???????????????????????????printf (" Wrong password ! \ n");
???????????????????????????getch ();
???????????????????????????system ("cls");
???????????????????????????printf ("Please re-enter : " ) ;
???????????????????????????scanf ("% d", & password);
???????????????????????????if (password == 123456)
????????????????????????????????????????system ("cls");
???????????????????????????if (sccs == 2)
???????????????????????????{
???????????????????????????????????printf (" enter the wrong password three consecutive times , the system automatically exits ! \ n");
???????????????????????????????????break;
???????????????????????????}
????????????????????????}
????????}
????????if (password == 123456)
????????????????????????{
????????????????????????????????system ("cls");
????????????????????????????????printf ("\ n");
????????????????????????????????printf ("汴 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 沍 \ n");
????????????????????????????????printf ("沃 Please select withdrawal amount ! 沃 \ n");
????????????????????????????????printf ("沃 ------------- ***** ------------ 沃 \ n");
????????????????????????????????printf ("沃 1. ㄓ 50 5. ㄓ 1000 沃 \ n");
????????????????????????????????printf ("沃 2. ㄓ 100 6. ㄓ 2000 沃 \ n");
????????????????????????????????printf ("沃 3. ㄓ 200 7. remaining amount 沃 \ n");
????????????????????????????????printf ("沃 4. ㄓ 500 8. Exit 沃 \ n");
????????????????????????????????printf ("沃 沃 \ n");
????????????????????????????????printf ("沂 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 災 \ n");
????????????????????????????????printf ("Please Choose: " ) ;
????????????????????????????????scanf ("% d", & xuanze);
????????????????????????????????system ("cls");
????????????????????????????????switch (xuanze)
????????????????????????????????????????{
????????????????????????????????????????case 1: printf ("汴 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 沍 \ n");
????????????????????????????????????????????????????????printf ("沃 withdrawal amount is $ 50 沃 \ n");
????????????????????????????????????????????????????????printf ("沃 Press any key to return 沃 \ n");
????????????????????????????????????????????????????????printf ("沂 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 災 \ n");
????????????????????????????????????????????????????????getch ();
????????????????????????????????????????????????????????system ("cls");
????????????????????????????????????????????????????????break;
????????????????????????????????????????case 2: printf ("汴 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 沍 \ n");
????????????????????????????????????????????????????????printf ("沃 withdrawal amount is $ 100 沃 \ n");
????????????????????????????????????????????????????????printf ("沃 Press any key to return 沃 \ n");
????????????????????????????????????????????????????????printf ("沂 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 災 \ n");
????????????????????????????????????????????????????????getch ();
????????????????????????????????????????????????????????system ("cls");
????????????????????????????????????????????????????????break;
????????????????????????????????????????case 3: printf ("汴 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 沍 \ n");
????????????????????????????????????????????????????????printf ("沃 withdrawal amount is $ 200 沃 \ n");
????????????????????????????????????????????????????????printf ("沃 Press any key to return 沃 \ n");
????????????????????????????????????????????????????????printf ("沂 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 災 \ n");
????????????????????????????????????????????????????????getch ();
????????????????????????????????????????????????????????system ("cls");
????????????????????????????????????????????????????????break;
????????????????????????????????????????case 4: printf ("汴 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 沍 \ n");
????????????????????????????????????????????????????????printf ("沃 withdrawal amount is $ 500 沃 \ n");
????????????????????????????????????????????????????????printf ("沃 Press any key to return 沃 \ n");
????????????????????????????????????????????????????????printf ("沂 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 災 \ n");
????????????????????????????????????????????????????????getch ();
????????????????????????????????????????????????????????system ("cls");
????????????????????????????????????????????????????????break;
????????????????????????????????????????case 5: printf ("汴 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 沍 \ n");
????????????????????????????????????????????????????????printf ("沃 withdrawals amounting to 1,000 yuan 沃 \ n");
????????????????????????????????????????????????????????printf ("沃 Press any key to return 沃 \ n");
????????????????????????????????????????????????????????printf ("沂 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 災 \ n");
????????????????????????????????????????????????????????getch ();
????????????????????????????????????????????????????????system ("cls");
????????????????????????????????????????????????????????break;
????????????????????????????????????????case 6: printf ("汴 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 沍 \ n");
????????????????????????????????????????????????????????printf ("沃 withdrawals amounting to 2,000 yuan 沃 \ n");
????????????????????????????????????????????????????????printf ("沃 Press any key to return 沃 \ n");
????????????????????????????????????????????????????????printf ("沂 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 汽 災 \ n");
????????????????????????????????????????????????????????getch ();
????????????????????????????????????????????????????????system ("cls");
???????