grhey

system

Jan 16th, 2023
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 21.11 KB | Source Code | 0 0
  1. //welcome to JMJ Tops
  2.  
  3. import java.util.InputMismatchException;
  4. import java.util.Scanner;
  5. class Stock {
  6.    
  7.          
  8.         static int order1;
  9.         static int order2;
  10.         static int order3;
  11.         static int order4;
  12.         static int order5;
  13.         static int order6;
  14.         static int minimalStock = 500;
  15.         static int poloStock = 500;
  16.         static int cropStock = 500;
  17.         static int overStock = 500;
  18.         static int animeStock = 500;
  19.         static int plainStock = 500;
  20.         static int size;   
  21.         static int minimalPrice = 350;
  22.         static int cropPrice = 200;
  23.         static int overPrice = 250;
  24.         static int animePrice = 300;
  25.         static int poloPrice = 350;
  26.         static int plainPrice = 200;
  27.         static double ship = 120.0;
  28.         static double cost1;
  29.         static double pay;
  30.         static double change;
  31.         static double cost;
  32.         static double cost2;
  33.         static double discount;
  34.         static double stock;
  35.  
  36.         static char choiceMain;
  37.         static Scanner h = new Scanner(System.in);
  38.        
  39. public static void main(String[] args) {
  40.            
  41.             System.out.println("Welcome to JMJ TOPS");
  42.             do{
  43.            
  44.             mainMenu();
  45.        
  46.             switch (choiceMain) {
  47.            
  48.             case 'A':{
  49.                    
  50.                 System.out.println("HOME");
  51.                    
  52.                
  53.                 break;
  54.             }
  55.            
  56.                                                                             case 'B':{             
  57.                                                                             SHOP();
  58.                                                                             int jay=h.nextInt();
  59.                                                                             h.nextLine();
  60.                                                                             switch(jay){
  61.                                                                             case 1:{
  62.                                                                                 String strInput;
  63.                                                                                 boolean valid = false;
  64.                                                                                 System.out.println("Polo shirt = 350");
  65.                                                                                 System.out.println("List Size");
  66.                                                                                 System.out.println("1.S");
  67.                                                                                 System.out.println("2.M");
  68.                                                                                 System.out.println("3.L");
  69.                                                                                 System.out.println("4.XL");
  70.  
  71.                                                                                 while(valid == false) {
  72.                                                                                     try {
  73.                                                                                         System.out.println("Enter your size:");
  74.                                                                                         strInput = h.nextLine();
  75.                                                                                         if(strInput.isEmpty() || (Integer.parseInt(strInput) < 1 || Integer.parseInt(strInput) > 4)){
  76.                                                                                             throw new Exception("Invalid size. Please enter a size between 1 and 4.");
  77.                                                                                         }
  78.                                                                                         size = Integer.parseInt(strInput);
  79.                                                                                         valid = true;
  80.  
  81.                                                                                         System.out.println();
  82.                                                                                         System.out.println("YOU CAN GET DISCOUNT 5% IF YOU BUY 10 OR MORE.");
  83.                                                                                         System.out.println("How many orders do you want? ");
  84.                                                                                         order1=Integer.parseInt(h.nextLine());
  85.  
  86.                                                                                         //if statement to get the discount depends of the order
  87.                                                                                         if(order1 >= 10) {
  88.                                                                                             cost2=poloPrice*order1;
  89.                                                                                             discount=cost2*.05;
  90.                                                                                             System.out.println("you recieved a discount of "+discount);
  91.                                                                                         }
  92.  
  93.                                                                                         stock=poloStock-order1;
  94.                                                                                         cost=poloPrice*order1-discount;
  95.                                                                                         System.out.println("Your Order polo shirt is total of P"+cost);
  96.                                                                                         System.out.println("Shipping fee:"+ship);
  97.                                                                                         cost1=cost+ship;
  98.  
  99.                                                                                         System.out.println("Your cash:");
  100.                                                                                         pay = Integer.parseInt(h.nextLine());
  101.                                                                                         change = pay-cost1;
  102.  
  103.                                                                                         System.out.println("Your cash is "+pay+ " and the change is "+change+".");  
  104.                                                                                         System.out.println("Your Order polo shirt plus shipping fee is total of P"+cost1);
  105.                                                                                         System.out.println("THANK YOU FOR SHOPPING!!!");
  106.                                                                                     } catch(InputMismatchException imeRef){
  107.                                                                                         System.out.println("Invalid input. Please enter a valid number.");
  108.                                                                                         h.nextLine();
  109.                                                                                         valid = false;
  110.                                                                                     } catch(Exception e){
  111.                                                                                         System.out.println("Error: " + e.getMessage());
  112.                                                                                         valid = false;
  113.                                                                                     }  
  114.                                                                                 }
  115.                                                                                 System.out.println();
  116.                                                                                 break;
  117.                                                                             }
  118.            
  119.                 case 2:{
  120.                     System.out.println("Plain Tshirt = 200");
  121.                            System.out.println("List Size");
  122.                            System.out.println("1.S");
  123.                            System.out.println("2.M");
  124.                            System.out.println("3.L");
  125.                            System.out.println("4.XL");
  126.                            try{
  127.                            System.out.println("Enter your size:");
  128.                            size= h.nextInt();
  129.                            System.out.println();
  130.                            System.out.println("YOU CAN GET DISCOUNT 5% IF YOU BUY 10 OR MORE.");
  131.                            System.out.println("How many orders do you want:");
  132.                            order2=h.nextInt();
  133.                            
  134.                          //if statement to get the discount depends of the order
  135.                            if(order2 >= 10) {
  136.                                cost2=plainPrice*order2;
  137.                                discount=cost2*.05;
  138.                                System.out.println("you recieved a discount of "+discount);
  139.                             }
  140.                            
  141.                            stock=plainStock-order2;
  142.                            cost=plainPrice*order2-discount;                        
  143.                            System.out.println("Your Order Plain Tshirt is total of P"+cost);
  144.                            System.out.println("Shipping fee:"+ship);
  145.                            cost1=cost+ship;
  146.                            System.out.println("Your cash:");
  147.                            pay = h.nextInt();
  148.                            change = pay-cost1;
  149.                            System.out.println("Your cash is "+pay+ " and the change is "+change);  
  150.                            System.out.println("Your Order Pain Tshirt plus shipping fee is total of P"+cost1);
  151.                            System.out.println("THANK YOU FOR SHOPPING!!!");
  152.                            }
  153.                            catch(InputMismatchException imeRef){
  154.                              System.out.println("Exception"+imeRef.toString());
  155.                            }
  156.                            catch(Exception e){
  157.                              System.out.println("Exception "+e.toString());
  158.                                }   
  159.                 System.out.println();
  160.                 break;
  161.                 }
  162.                 case 3:{
  163.                
  164.                     System.out.println("Crop tops = 200");
  165.                            System.out.println("List Size");
  166.                            System.out.println("1.S");
  167.                            System.out.println("2.M");
  168.                            System.out.println("3.L");
  169.                            System.out.println("4.XL");
  170.                            try{
  171.                            System.out.println("Enter your size:");
  172.                            size= h.nextInt();
  173.                            System.out.println();
  174.                            System.out.println("YOU CAN GET DISCOUNT 5% IF YOU BUY 10 OR MORE.");
  175.                            System.out.println("How many orders do you want:");
  176.                            order3=h.nextInt();
  177.                            
  178.                            //if statement to get the discount depends of the order
  179.                            if(order3 >= 10) {
  180.                                cost2=cropPrice*order3;
  181.                                discount=cost2*.05;
  182.                                System.out.println("you recieved a discount of "+discount);
  183.                             }
  184.      
  185.                            stock=cropStock-order3;
  186.                            cost=cropPrice*order3-discount;
  187.                            System.out.println("Your Order Crop Tops is total of P"+cost);
  188.                            System.out.println("Shipping fee:"+ship);
  189.                            cost1=cost+ship;
  190.                            System.out.println("Your cash:");
  191.                            pay = h.nextInt();
  192.                            change = pay-cost1;
  193.                            System.out.println("Your cash is "+pay+ " and the change is "+change);
  194.                            
  195.                            System.out.println("Your Order crop-tops plus shipping fee is total of P"+cost1);
  196.                            System.out.println("THANK YOU FOR SHOPPING!!!");
  197.                            }
  198.                            catch(InputMismatchException imeRef){
  199.                              System.out.println("Exception"+imeRef.toString());
  200.                            }
  201.                            catch(Exception e){
  202.                              System.out.println("Exception "+e.toString());
  203.                            }   
  204.                           System.out.println();
  205.                     break;
  206.                 }
  207.                 case 4:{
  208.                     System.out.println("Oversize Tshirt = 250");
  209.                            System.out.println("List Size");
  210.                            System.out.println("1.S");
  211.                            System.out.println("2.M");
  212.                            System.out.println("3.L");
  213.                            System.out.println("4.Xl");
  214.                            try{
  215.                            System.out.println("Enter your size:");
  216.                            size= h.nextInt();
  217.                            if(size <= 4) {
  218.                                System.out.println("you choose size " +size);
  219.                            }
  220.                            else {
  221.                                System.out.println("wala sa choice, pili og balik ");
  222.                            }
  223.                            System.out.println("Enter your size:");
  224.                            size= h.nextInt();
  225.                            
  226.                            System.out.println();
  227.                            System.out.println("YOU CAN GET DISCOUNT 5% IF YOU BUY 10 OR MORE.");
  228.                            System.out.println("How many orders do you want:");
  229.                            order4=h.nextInt();
  230.                            
  231.                          //if statement to get the discount depends of the order
  232.                            if(order4 >= 10) {
  233.                                cost2=overPrice*order4;
  234.                                discount=cost2*.05;
  235.                                System.out.println("you recieved a discount of "+discount);
  236.                             }
  237.                            
  238.                            stock=overStock-order4;
  239.                            cost=overPrice*order4-discount;
  240.                            System.out.println("Your Order Oversize Tshirt is total of P"+cost);
  241.                            System.out.println("Shipping fee:"+ship);
  242.                            cost1=cost+ship;
  243.                            System.out.println("Your cash:");
  244.                            pay = h.nextInt();
  245.                            change = pay-cost1;
  246.                            System.out.println("Your cash is "+pay+ " and the change is "+change);
  247.                            
  248.                            System.out.println("Your Order Oversize Tshirt plus shipping fee is total of P"+cost1);
  249.                            System.out.println("THANK YOU FOR SHOPPING!!!");
  250.                            }
  251.                            catch(InputMismatchException imeRef){
  252.                              System.out.println("Exception"+imeRef.toString());
  253.                            }
  254.                            catch(Exception e){
  255.                              System.out.println("Exception "+e.toString());
  256.                            }   
  257.                            System.out.println();
  258.                     break;
  259.                 }
  260.                 case 5:{
  261.                     System.out.println("Anime Tshirt = 300");
  262.                            System.out.println("List Size");
  263.                            System.out.println("1.S");
  264.                            System.out.println("2.M");
  265.                            System.out.println("3.L");
  266.                            System.out.println("4.Xl");
  267.                            try{
  268.                            System.out.println("Enter your size:");
  269.                            size= h.nextInt();
  270.                            System.out.println();
  271.                            System.out.println("YOU CAN GET DISCOUNT 5% IF YOU BUY 10 OR MORE.");
  272.                            System.out.println("How many orders do you want:");
  273.                            order5=h.nextInt();
  274.                            
  275.                          //if statement to get the discount depends of the order
  276.                            if(order5 >= 10) {
  277.                                cost2=animePrice*order5;
  278.                                discount=cost2*.05;
  279.                                System.out.println("you recieved a discount of "+discount);
  280.                             }
  281.                            
  282.                            stock=animeStock-order5;
  283.                            cost=animePrice*order5-discount;
  284.                            System.out.println("Your Order Anime Tshirt is total of P"+cost);
  285.                            System.out.println("Shipping fee:"+ship);
  286.                            cost1=cost+ship;
  287.                            System.out.println("Your cash:");
  288.                            pay = h.nextInt();
  289.                            change = pay-cost1;
  290.                            System.out.println("Your cash is "+pay+ " and the change is "+change);
  291.                            
  292.                            System.out.println("Your Order Anime Tshirt plus shipping fee is total of P"+cost1);
  293.                            System.out.println("THANK YOU FOR SHOPPING!!!");
  294.                            }
  295.                            catch(InputMismatchException imeRef){
  296.                              System.out.println("Exception"+imeRef.toString());
  297.                            }
  298.                            catch(Exception e){
  299.                              System.out.println("Exception "+e.toString());
  300.                            }   
  301.                            System.out.println();
  302.                    
  303.                     break;
  304.                    
  305.                 }
  306.                 case 6:{
  307.                     try{
  308.                     System.out.println("Minimalist Tshirts = 350");
  309.                            System.out.println("List Size");
  310.                            System.out.println("1.S");
  311.                            System.out.println("2.M");
  312.                            System.out.println("3.L");
  313.                            System.out.println("4.Xl");
  314.                            
  315.                            System.out.println("Enter your size:");
  316.                            size= h.nextInt();
  317.                            System.out.println();
  318.                            System.out.println("YOU CAN GET DISCOUNT 5% IF YOU BUY 10 OR MORE.");
  319.                            System.out.println("How many orders do you want:");
  320.                            order6=h.nextInt();
  321.                            
  322.                          //if statement to get the discount, depends of the orderS
  323.                            if(order6 >= 10) {
  324.                                cost2=minimalPrice*order6;
  325.                                discount=cost2*.05;
  326.                                System.out.println("you recieved a discount of "+discount);
  327.                             }
  328.                            
  329.                            stock=minimalStock-order6;
  330.                            cost=minimalPrice*order6-discount;
  331.                            System.out.println("Your Order Minimalist Tshirt is total of P"+cost);
  332.                            System.out.println("Shipping fee:"+ship);
  333.                            cost1=cost+ship;
  334.                            System.out.println("Your cash:");
  335.                            pay = h.nextInt();
  336.                            change = pay-cost1;
  337.                            System.out.println("Your cash is "+pay+ " and the change is "+change);
  338.                            
  339.                            System.out.println("Your Order Minimalist Tshirts plus shipping fee is total of P"+cost1);
  340.                            System.out.println("THANK YOU FOR SHOPPING!!!");
  341.                            }
  342.                            catch(InputMismatchException imeRef){
  343.                              System.out.println("Exception"+imeRef.toString());
  344.                            }
  345.                            catch(Exception e){
  346.                              System.out.println("Exception "+e.toString());
  347.                            }   
  348.                            System.out.println();
  349.                     break;
  350.                 }
  351.                    
  352.                 }
  353.                
  354.             break;
  355.                 }              
  356.             //Case C, IT SHOWS THE STOCK LEFT OF UNSOLD ITEM
  357.             case 'C':{
  358.                 update();
  359.                   stock=plainStock-order2;
  360.                   stock=minimalStock-order6;
  361.                   stock=overStock-order4;
  362.                   stock=animeStock-order5;
  363.                   stock=poloStock-order1;
  364.                   stock=cropStock-order3;
  365.                
  366.                 break;
  367.                 }
  368.             case 'D':{
  369.                  
  370.                System.out.println("ABOUT US");
  371.                System.out.println("We serve good quality products.We assure that you cannot regret it."
  372.                        +"JAYHEJKGRGJECKRJGMRJHGJR"
  373.                     + "JHJRHCGIRUHCGNREHCIWCMR ");
  374.                System.out.println();
  375.                 break;
  376.                 }
  377.            
  378.             case 'E':{
  379.                   address();
  380.                         break;
  381.                       }
  382.                   //default :
  383.                   //System.out.println("!!!Sayup Wala sa choice imong gipili!!!");
  384.                   //System.out.println();
  385.                   // break;
  386.                       }
  387.              }while(choiceMain!='F');
  388.         }
  389.        
  390.  
  391.         public static void mainMenu() {
  392.        
  393.             System.out.println("A. HOME");
  394.             System.out.println("B. SHOP");
  395.             System.out.println("C. UPDATE");
  396.             System.out.println("D. ABOUT");
  397.             System.out.println("E. ADDRESS BOOK");
  398.             System.out.println("F. EXIT");
  399.             try {
  400.             System.out.println("Enter your choice: ");
  401.                   choiceMain = h.next().charAt(0);
  402.            
  403.             }
  404.             catch(InputMismatchException imeRef){
  405.             System.out.println("Exception "+imeRef.toString());
  406.             }
  407.             catch(Exception e){
  408.             System.out.println("Exception "+e.toString());  
  409.             }
  410.            
  411.            
  412. }
  413.         public static void SHOP() {
  414.            
  415.         System.out.println("\t\t\t>>>Welcom to JMJ TOPS<<<");
  416.         System.out.println("\t\t\t\tPRODUCTS");
  417.         System.out.println("\t\t1.Polo Shirts");
  418.         System.out.println("\t\t2.Plain Tshirts");
  419.         System.out.println("\t\t3.Crop Tops");
  420.         System.out.println("\t\t4.Oversize Tshirt");
  421.         System.out.println("\t\t5.Anime Tshirts");
  422.         System.out.println("\t\t6.Minimalist Tshirts");
  423.         try {
  424.         System.out.println("Select a Product Category: ");
  425.         }
  426.         catch(InputMismatchException ime){
  427.         System.out.println("Exception "+ime.toString());
  428.         }
  429.         catch(Exception e){
  430.         System.out.println("Exception "+e.toString());
  431.         }
  432.         }
  433.  
  434.        
  435.         public static void update() {
  436.          System.out.println(">>>>STOCK UPDATE<<<<");
  437.                
  438.          System.out.println("Plain Tshirt left    ="+(plainStock-order2));
  439.          System.out.println("Polo shirt left      ="+(poloStock-order1));
  440.          System.out.println("Minimalist left      ="+(minimalStock-order6));
  441.          System.out.println("Oversize Tshirt left ="+(overStock-order4));
  442.          System.out.println("Anime Tshirt left    ="+(animeStock-order5));
  443.          System.out.println("crop-top shirt left  ="+(cropStock-order3));
  444.          System.out.println();
  445.                 }
  446.  
  447.         public static void address(){
  448.        
  449.        
  450.         String name;
  451.         String address;
  452.         int contact;
  453.        
  454.         try{
  455.               System.out.println("Your Name:");
  456.                name = h.nextLine();
  457.                name = h.nextLine();
  458.                System.out.println();
  459.                
  460.                System.out.println("Your contact number:");
  461.                contact = h.nextInt();
  462.                System.out.println();
  463.                
  464.                System.out.println("Your Address:");
  465.                address = h.nextLine();
  466.                address = h.nextLine();
  467.               System.out.println();
  468.              
  469.               System.out.println("\t>>>SHIPPING INFORMATION<<<");
  470.               System.out.println();
  471.               System.out.println("\tName of customer: "+name);
  472.               System.out.println("\tCustomer contact number: +63"+contact);
  473.               System.out.println("\tCustomer Address: "+address);
  474.               System.out.println("Your Order is total of P"+cost1);
  475.               System.out.println("AGAIN MAAM and SIR, THANK YOU FOR SHOPPING...........");
  476.               System.out.println();
  477.               }
  478.           catch(InputMismatchException imeRef){
  479.               System.out.println("Exception"+imeRef.toString());
  480.               }
  481.           catch(Exception e){
  482.               System.out.println("Exception "+e.toString());
  483.               }
  484.         }
  485.     }
Advertisement
Add Comment
Please, Sign In to add comment