Java ATM Machine

Source: Internet
Author: User

Tag:scan   int    selection    exit   size    mil   .com   ;;    zhang   

Package Test;import Java.util.*;class acount{string Kahao; String name; String date; String mima;double Yue;  Scanner input = new Scanner (system.in);p ublic acount (String k,string n,string d,string m,double y) {Kahao = K;name = N;date = D;mima = M;yue = y;} public void Setkahao (String k) {Kahao = k;} Public String Getkahao () {return kahao;} public void Setyue (double y) {Yue = y;} Public double Getyue () {return yue;} public void SetName (String n) {name = n;} Public String GetName () {return name;} public void Setdate (String d) {date = D;} Public String getdate () {return date;} public void Setmima (String m) {mima = m;} Public String Getmima () {return mima;} public void Qukuan () {int m;for (m=0;; m++) {System.out.println ("Please select the withdrawal amount:"); System.out.println ("1, 100 Yuan"); System.out.println ("2, 500 Yuan"); System.out.println ("3, 1000 Yuan"); System.out.println ("4, 1500 Yuan"); System.out.println ("5, 2000 Yuan"); System.out.println ("6, 5000 Yuan"); System.out.println ("7, other Amount"); System.out.println ("8, Return card"), int a = Input.nextint (), if (a = = 1) {Yue = yue-100;} IF (A = = 2) {Yue = yue-500;} if (a = = 3) {Yue = yue-1000;} if (a = = 4) {Yue = yue-1500;} if (a = = 5) {Yue = yue-2000;} if (a = = 6) {Yue = yue-5000;} if (a = = 7) {System.out.println ("Please enter the withdrawal amount:"), int b = Input.nextint (); yue = yue-b;} if (a = = 8) {break;}}} public void Zhuanzhang () {System.out.println ("Please enter the transfer line number:"); String n = input.next (), if (N.equals (Getkahao ())) {System.out.println ("Please enter transfer amount:"); int j = Input.nextint (); yue = Yue + j;} Else{system.out.println ("No Man!") "); System.exit (0);}} public void Xiugaimima () {System.out.println ("Please enter the line number to be modified:"); String n = input.next (), if (N.equals (Getkahao ())) {System.out.println ("Please enter a new password:"); String m = Input.next (); mima= m; SYSTEM.OUT.PRINTLN ("modified successfully"); System.exit (0);}} public void Chaxun () {System.out.println ("Please enter the line number of the query:"); String m = Input.next (), if (M.equals (Getkahao ())) {System.out.println ("balance is" + getyue ());} ElseSystem.out.println ("does not Exist");} public void Cunkuan () {System.out.println ("Please enter Amount:");d ouble B = input.nextdouble (); yue = yue+b;} public void Denglu () {System.out.println ("Please enter card number:"); String n = input.next (); System.out.println ("Please enter password:"); String m = Input.next (), if (M.equals (Getmima ()) &&n.equals (Getkahao ())) {System.out.println ("login succeeded"); int t;for (t=0;; t++) {System.out.println ("Please select:"); System.out.println ("1, withdrawals"); System.out.println ("2, transfer"); System.out.println ("3, deposit"); System.out.println ("4, Enquiry Balance"); System.out.println ("5, Change Password"); System.out.println ("6, Return card"), int a = Input.nextint (), if (a = = 1) {Qukuan ();} if (a = = 2) {Zhuanzhang ();} if (a = = 3) {Cunkuan ();} if (a = = 4) {Chaxun ();} if (a = = 5) {Xiugaimima ();} if (a = = 6) {break;}}} ELSE{SYSTEM.OUT.PRINTLN ("Bad password!") "); System.exit (0);}} public class Atmshow {public static void main (string[] args) {acount A = new Acount ("11111", "HYY", "20161", "123456", 1000); A.denglu ();}}

  :

Java ATM Machine

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.