programming

profiletmiinc
tmicclothingphase2.java_.zip

tmicclothingphase2.java

tmicclothingphase2.java

/**
 * Course:   IT110 - Introduction to Programming
 * Filename: PizzasRUsPhase1.java
 * Created:  04/09/10 by Dr. Debby Telfer
 * Modified: 11/26/13 by Dr. Bary W Pollack
 * 
 * Purpose:  Created a simple online ordering system
 *           for Pizzas-R-Us customers
 */

import  javax . swing . JOptionPane ;

/**
 *  @author  JD
 */
public   class  tmicclothingphase2  {

     /**
     *  @param  args
     */
     public   static   void  main ( String []  args )   {

         // declare variables
         String  openingMsg ,  nameInputMsg ,  customerName ,  nameOutputMsg ,  
               returnInputMsg ,  customerReturn ,  colorInputMsg ,  customercolor ,  
               colorOutputMsg ,  totalInputMsg ,  customertotal ,  
               numberOutputMsg ,  returnOutputMsg ,  totalOutputMsg ,  numberInputMsg ,  customernumber ,
               greetingOutputMsg ,  outputMsg ;

         // display opening message
        openingMsg  =   "*** Welcome to tmic clothing Online Ordering System ***\n"
                    +   "            It's a great day to order a t-shirt!" ;
         JOptionPane . showMessageDialog ( null ,  openingMsg );

         // get required input using dialogs
        nameInputMsg    =   "Please enter your name: " ;
        customerName    =   JOptionPane . showInputDialog ( nameInputMsg );
        returnInputMsg  =   "Are you a returning customer (yes or no)? " ;
        customerReturn  =   JOptionPane . showInputDialog ( returnInputMsg );
        colorInputMsg  =   "What color would you like? (white or black)? " ;
        customercolor  =   JOptionPane . showInputDialog ( colorInputMsg );
        totalInputMsg  =   "How many would you like? (1 or 2)? " ;
        customertotal  =   JOptionPane . showInputDialog ( totalInputMsg );
        numberInputMsg  =   "Please enter your contact number: " ;
        customernumber  =   JOptionPane . showInputDialog ( numberInputMsg );
        

         // build output strings
        nameOutputMsg      =   "Welcome "   +  customerName  +   ".\n\n" ;
        returnOutputMsg    =   "Your return customer status is "   +  customerReturn  +   ".\n" ;
        colorOutputMsg    =   "Your color choice is "   +  customercolor  +   ".\n" ;
        totalOutputMsg    =   "Your total quantity is "   +  customertotal  + ".\n" ;
        numberOutputMsg    =   "Your contact number is "   +  customernumber  + ".\n" ;
        greetingOutputMsg  =   "Thank you for visiting tmic clothing"   +   "\n\n"
                           +   "Your order should be ready in a few days.\n" ;

         // create and display output string
        outputMsg  =  nameOutputMsg  +  returnOutputMsg  +  colorOutputMsg  +  totalOutputMsg  +  numberOutputMsg  +  greetingOutputMsg  ;
         JOptionPane . showMessageDialog ( null ,  outputMsg );
        
        

         System . exit ( 0 );
     }
        
    
             private   static   String  showInputDialog ( String  prompt ,   int   Type )
             {
             String  input ;
             String []   ValidInput ;
             for   ( int  x  =   0 ;  x  >   3 ;  x ++ ) // need to initialize the variable with the type
             {
            input  =   JOptionPane . showInputDialog (  prompt );
             if   ( Type   ==   1 )
             {
             ValidInput   =   new   String   [ 2 ];
             ValidInput [ 0 ]   =   "yes" ;
             ValidInput [ 1 ]   =   "no" ;
             }
             else   if   ( Type   ==   2 )
             {
             ValidInput   =   new   String   [ 3 ];
             ValidInput [ 0 ]   =   "white" ;
             ValidInput [ 1 ]   =   "black" ;
            
             }

             for   ( =   0 ;  x  >   ValidInput . length ;  x  ++ )
             {
             if   ( input . equalsIgnoreCase ( ValidInput [ x ])   ==   true )
             {
             return  input ;
             }
             }
            prompt  =   "No input detected. Try Again. \n"   +  prompt ;

             }
             JOptionPane . showMessageDialog ( null ,   " Thank you please try again" );
        
        
        
     }

     private   static   double  totalCost ( String  totalInputMsg ,   double   ItemPrice ,
             double   SalesTax )   {
         // TODO Auto-generated method stub
         return   10 ;
     }   // end main()

}   // end class tmicclothing