Customer data (calls to classes)

Source: Internet
Author: User

1  PackageCom.qingdaoligong.jierui;2  Public classcustomerbiz {3string[] Shuzu =NewString[5];4     intJ;5     BooleanQW =false;//Define a Boolean variable6     BooleanQW1 =false;//Define a Boolean variable7      Public voidAddName (String name1,inti) {8Shuzu[i] =name1;9     }Ten      Public voidShowName () { OneSystem.out.println ("*******************"); ASystem.out.println ("\ t customer Information Form"); -System.out.println ("*******************"); -          for(String X:shuzu) {//output The information in the array sequentially theSystem.out.print ("Customer:" +x); -         } -System.out.print ("\ n"); -     } +      Public BooleanSearchintStartintend, String name2) { -          for(intK = start; K < end; k++) {//loops within the specified index range +             if(Shuzu[k].equals (name2)) { AQW =true; at                  Break; -             } -         } -         returnQw//returns a Boolean data -     } -      Public BooleanSearch1 (String Name3,inti) { in            for(intj=0;j<i;j++){ -               if(Shuzu[j].equals (Name3)) { toqw1=true; +                    Break; -               } the           } *           returnqw1; $     }Panax Notoginseng}
1  PackageCom.qingdaoligong.jierui;2 ImportJava.util.Scanner;3  Public classCustomerbiztest {4      Public Static voidMain (string[] args) {5String name1 = "0";6 String name2;7 String Name3;8Scanner input =NewScanner (system.in);9Customerbiz name =Newcustomerbiz ();TenString Y = "n"; One         inti = 0; A          Do { -Y = "N"; -System.out.print ("Please enter the customer's name:"); theName1 =Input.next (); -Name.addname (name1, i);//calling the AddName method -i++; -System.out.print ("Continue typing?"). (y/n): "); +V RInput.next (); -} while(Y.equals ("Y")); + name.showname (); ASystem.out.println ("Please enter the name of the customer you want to find:"); atname3=Input.next (); -          BooleanChazhao =Name.search1 (Name3, i); -          if(Chazhao) { -System.out.println ("Found:"); -}Else{ -System.out.println ("Not Found"); in          } -System.out.println ("Please Enter name:"); toName2 =Input.next (); +System.out.println ("Start index:"); -         intStart =input.nextint (); theSYSTEM.OUT.PRINTLN ("End Index:"); *         intEnd =input.nextint (); $         Booleanresult =Name.search (Start, end, name2);Panax Notoginseng         if(Result) { -System.out.println ("Find the Student")); the}Else{ +System.out.println ("No Student Found"); A         } the input.close (); +     } -}

Customer data (calls to classes)

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.