java Inventory Management

 

Import java.util.Scanner;
 Import java.util.Random;
 class kuCun 
{ 
    public  static  void main (String [] args) 
    { 
        // Stock Management: Package: 
        String [] [] = {{List "TV", " 3 "}, {" detergent "," 8 "}, {" table salt "," 5 "}, {" chewing gum "," 10 " }}; 
        Scanner SC = new new Scanner (the System.in); 
        
        AA: the while ( to true ) { 
        System.out.println ( "inventory management --------- ---------" ); 
        System.out.println ( "1. Check inventory" ); 
        System.out.println ( "2. Modify merchandise inventory quantity" );
        System.out.println ( "3. Exit" ); 
        System.out.println ( "--------------------------" ); 
        System .out.println ( "Please input operation number to be performed:" );
             int in = sc.nextInt ();
             Switch (in) {
             Case . 1 : 
                look (List); 
            BREAK ;
             Case 2 : 
                SELECT (List); 
            BREAK ;
             Case . 3 :
                 BREAK AA;
             default : 
                System.out.println ("--------------------------" ); 
                System.out.println ( "Please enter the correct operation of the serial number!" ); 
                System.out .println ( "--------------------------" );
             BREAK ; 
            } 
        } 
    } 
    // print inventory functions 
    public  static  void look (String [] [] List) {
         for ( int I = 0; I <List.length; I ++ ) {
             for ( int J = 0; J <List [I] .length; J ++ ) {
                 IF (J == 0 ) { 
                    System.out.print ("Product Name:" + List [I] [J] + "" ); 
                } the else  IF (J ==. 1 ) { 
                    of System.out.print ( "Stock number:" + List [I] [J]); 
                } 
            } 
            System.out.println (); 
        } 
    } 
    // number of stock modify the function 
    public  static  void the SELECT (String [] [] List) { 
        System.out.println ( "Please enter the number you want to modify goods" );
         for ( int I = 0; I <List.length; I ++ ) { 
            of System.out.print ((I + 1'd) + ":" + List [I] [0 ]);
        Scanner sc 
            System.out.println ();
        }= New new Scanner (the System.in);
         int in = sc.nextInt (); 
    BB: the while ( to true ) {
             Switch (in) {
             Case . 1 : 
                System.out.println ( "trade name:" + list [in- . 1] [0 ]); 
                System.out.println ( "edit inventory quantity" ); 
                String the Add = sc.next (); 
                List [in -1] [. 1] = the Add; 
                System.out.println ( "modify after the "+ list [in-1] [0] +" stock is: "+ the Add); 
                System.out.println (); 
                BREAKBB;
             Case 2 : 
                System.out.println ( "trade name:" + List [-in. 1] [0 ]); 
                System.out.println ( "edit inventory quantity" ); 
                the Add = sc.next () ; 
                List [in -1] [. 1] = the Add; 
                System.out.println ( "modified" + list [in-1] [0] + " stock is:" + the Add); 
                System.out.println ( ); 
                BREAK BB;
             Case . 3 : 
                System.out.println ( "trade name:" + List [-in. 1] [0 ]); 
                System.out.println ( "edit inventory quantity" ); 
                The Add = sc.next (); 
                List [in -1] [. 1] = the Add; 
                System.out.println ( "modified" + list [in-1] [0] + " stock is:" + the Add); 
                System.out.println (); 
                BREAK BB;
             Case . 4 : 
                System.out.println ( "trade name:" + List [-in. 1] [0 ]); 
                System.out.println ( "edit Stock number " ); 
                the Add = sc.next (); 
                List [in -1] [. 1] = the Add; 
                System.out.println ( " modified "+ list [in-1] [0] +" for the stock : "+add);
                System.out.println (); 
                BREAK bb;
             Case 00 :
                 BREAK bb;
             default : 
                System.out.println ( "Please enter the correct product serial number" ); 
                in = sc.nextInt ();
                 BREAK ; 
            } 
        } 
    } 
}

Guess you like

Origin www.cnblogs.com/l1314/p/12035662.html