Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //welcome to JMJ Tops
- import java.util.InputMismatchException;
- import java.util.Scanner;
- class Stock {
- static int order1;
- static int order2;
- static int order3;
- static int order4;
- static int order5;
- static int order6;
- static int minimalStock = 500;
- static int poloStock = 500;
- static int cropStock = 500;
- static int overStock = 500;
- static int animeStock = 500;
- static int plainStock = 500;
- static int size;
- static int minimalPrice = 350;
- static int cropPrice = 200;
- static int overPrice = 250;
- static int animePrice = 300;
- static int poloPrice = 350;
- static int plainPrice = 200;
- static double ship = 120.0;
- static double cost1;
- static double pay;
- static double change;
- static double cost;
- static double cost2;
- static double discount;
- static double stock;
- static char choiceMain;
- static Scanner h = new Scanner(System.in);
- public static void main(String[] args) {
- System.out.println("Welcome to JMJ TOPS");
- do{
- mainMenu();
- switch (choiceMain) {
- case 'A':{
- System.out.println("HOME");
- break;
- }
- case 'B':{
- SHOP();
- int jay=h.nextInt();
- h.nextLine();
- switch(jay){
- case 1:{
- String strInput;
- boolean valid = false;
- System.out.println("Polo shirt = 350");
- System.out.println("List Size");
- System.out.println("1.S");
- System.out.println("2.M");
- System.out.println("3.L");
- System.out.println("4.XL");
- while(valid == false) {
- try {
- System.out.println("Enter your size:");
- strInput = h.nextLine();
- if(strInput.isEmpty() || (Integer.parseInt(strInput) < 1 || Integer.parseInt(strInput) > 4)){
- throw new Exception("Invalid size. Please enter a size between 1 and 4.");
- }
- size = Integer.parseInt(strInput);
- valid = true;
- System.out.println();
- System.out.println("YOU CAN GET DISCOUNT 5% IF YOU BUY 10 OR MORE.");
- System.out.println("How many orders do you want? ");
- order1=Integer.parseInt(h.nextLine());
- //if statement to get the discount depends of the order
- if(order1 >= 10) {
- cost2=poloPrice*order1;
- discount=cost2*.05;
- System.out.println("you recieved a discount of "+discount);
- }
- stock=poloStock-order1;
- cost=poloPrice*order1-discount;
- System.out.println("Your Order polo shirt is total of P"+cost);
- System.out.println("Shipping fee:"+ship);
- cost1=cost+ship;
- System.out.println("Your cash:");
- pay = Integer.parseInt(h.nextLine());
- change = pay-cost1;
- System.out.println("Your cash is "+pay+ " and the change is "+change+".");
- System.out.println("Your Order polo shirt plus shipping fee is total of P"+cost1);
- System.out.println("THANK YOU FOR SHOPPING!!!");
- } catch(InputMismatchException imeRef){
- System.out.println("Invalid input. Please enter a valid number.");
- h.nextLine();
- valid = false;
- } catch(Exception e){
- System.out.println("Error: " + e.getMessage());
- valid = false;
- }
- }
- System.out.println();
- break;
- }
- case 2:{
- System.out.println("Plain Tshirt = 200");
- System.out.println("List Size");
- System.out.println("1.S");
- System.out.println("2.M");
- System.out.println("3.L");
- System.out.println("4.XL");
- try{
- System.out.println("Enter your size:");
- size= h.nextInt();
- System.out.println();
- System.out.println("YOU CAN GET DISCOUNT 5% IF YOU BUY 10 OR MORE.");
- System.out.println("How many orders do you want:");
- order2=h.nextInt();
- //if statement to get the discount depends of the order
- if(order2 >= 10) {
- cost2=plainPrice*order2;
- discount=cost2*.05;
- System.out.println("you recieved a discount of "+discount);
- }
- stock=plainStock-order2;
- cost=plainPrice*order2-discount;
- System.out.println("Your Order Plain Tshirt is total of P"+cost);
- System.out.println("Shipping fee:"+ship);
- cost1=cost+ship;
- System.out.println("Your cash:");
- pay = h.nextInt();
- change = pay-cost1;
- System.out.println("Your cash is "+pay+ " and the change is "+change);
- System.out.println("Your Order Pain Tshirt plus shipping fee is total of P"+cost1);
- System.out.println("THANK YOU FOR SHOPPING!!!");
- }
- catch(InputMismatchException imeRef){
- System.out.println("Exception"+imeRef.toString());
- }
- catch(Exception e){
- System.out.println("Exception "+e.toString());
- }
- System.out.println();
- break;
- }
- case 3:{
- System.out.println("Crop tops = 200");
- System.out.println("List Size");
- System.out.println("1.S");
- System.out.println("2.M");
- System.out.println("3.L");
- System.out.println("4.XL");
- try{
- System.out.println("Enter your size:");
- size= h.nextInt();
- System.out.println();
- System.out.println("YOU CAN GET DISCOUNT 5% IF YOU BUY 10 OR MORE.");
- System.out.println("How many orders do you want:");
- order3=h.nextInt();
- //if statement to get the discount depends of the order
- if(order3 >= 10) {
- cost2=cropPrice*order3;
- discount=cost2*.05;
- System.out.println("you recieved a discount of "+discount);
- }
- stock=cropStock-order3;
- cost=cropPrice*order3-discount;
- System.out.println("Your Order Crop Tops is total of P"+cost);
- System.out.println("Shipping fee:"+ship);
- cost1=cost+ship;
- System.out.println("Your cash:");
- pay = h.nextInt();
- change = pay-cost1;
- System.out.println("Your cash is "+pay+ " and the change is "+change);
- System.out.println("Your Order crop-tops plus shipping fee is total of P"+cost1);
- System.out.println("THANK YOU FOR SHOPPING!!!");
- }
- catch(InputMismatchException imeRef){
- System.out.println("Exception"+imeRef.toString());
- }
- catch(Exception e){
- System.out.println("Exception "+e.toString());
- }
- System.out.println();
- break;
- }
- case 4:{
- System.out.println("Oversize Tshirt = 250");
- System.out.println("List Size");
- System.out.println("1.S");
- System.out.println("2.M");
- System.out.println("3.L");
- System.out.println("4.Xl");
- try{
- System.out.println("Enter your size:");
- size= h.nextInt();
- if(size <= 4) {
- System.out.println("you choose size " +size);
- }
- else {
- System.out.println("wala sa choice, pili og balik ");
- }
- System.out.println("Enter your size:");
- size= h.nextInt();
- System.out.println();
- System.out.println("YOU CAN GET DISCOUNT 5% IF YOU BUY 10 OR MORE.");
- System.out.println("How many orders do you want:");
- order4=h.nextInt();
- //if statement to get the discount depends of the order
- if(order4 >= 10) {
- cost2=overPrice*order4;
- discount=cost2*.05;
- System.out.println("you recieved a discount of "+discount);
- }
- stock=overStock-order4;
- cost=overPrice*order4-discount;
- System.out.println("Your Order Oversize Tshirt is total of P"+cost);
- System.out.println("Shipping fee:"+ship);
- cost1=cost+ship;
- System.out.println("Your cash:");
- pay = h.nextInt();
- change = pay-cost1;
- System.out.println("Your cash is "+pay+ " and the change is "+change);
- System.out.println("Your Order Oversize Tshirt plus shipping fee is total of P"+cost1);
- System.out.println("THANK YOU FOR SHOPPING!!!");
- }
- catch(InputMismatchException imeRef){
- System.out.println("Exception"+imeRef.toString());
- }
- catch(Exception e){
- System.out.println("Exception "+e.toString());
- }
- System.out.println();
- break;
- }
- case 5:{
- System.out.println("Anime Tshirt = 300");
- System.out.println("List Size");
- System.out.println("1.S");
- System.out.println("2.M");
- System.out.println("3.L");
- System.out.println("4.Xl");
- try{
- System.out.println("Enter your size:");
- size= h.nextInt();
- System.out.println();
- System.out.println("YOU CAN GET DISCOUNT 5% IF YOU BUY 10 OR MORE.");
- System.out.println("How many orders do you want:");
- order5=h.nextInt();
- //if statement to get the discount depends of the order
- if(order5 >= 10) {
- cost2=animePrice*order5;
- discount=cost2*.05;
- System.out.println("you recieved a discount of "+discount);
- }
- stock=animeStock-order5;
- cost=animePrice*order5-discount;
- System.out.println("Your Order Anime Tshirt is total of P"+cost);
- System.out.println("Shipping fee:"+ship);
- cost1=cost+ship;
- System.out.println("Your cash:");
- pay = h.nextInt();
- change = pay-cost1;
- System.out.println("Your cash is "+pay+ " and the change is "+change);
- System.out.println("Your Order Anime Tshirt plus shipping fee is total of P"+cost1);
- System.out.println("THANK YOU FOR SHOPPING!!!");
- }
- catch(InputMismatchException imeRef){
- System.out.println("Exception"+imeRef.toString());
- }
- catch(Exception e){
- System.out.println("Exception "+e.toString());
- }
- System.out.println();
- break;
- }
- case 6:{
- try{
- System.out.println("Minimalist Tshirts = 350");
- System.out.println("List Size");
- System.out.println("1.S");
- System.out.println("2.M");
- System.out.println("3.L");
- System.out.println("4.Xl");
- System.out.println("Enter your size:");
- size= h.nextInt();
- System.out.println();
- System.out.println("YOU CAN GET DISCOUNT 5% IF YOU BUY 10 OR MORE.");
- System.out.println("How many orders do you want:");
- order6=h.nextInt();
- //if statement to get the discount, depends of the orderS
- if(order6 >= 10) {
- cost2=minimalPrice*order6;
- discount=cost2*.05;
- System.out.println("you recieved a discount of "+discount);
- }
- stock=minimalStock-order6;
- cost=minimalPrice*order6-discount;
- System.out.println("Your Order Minimalist Tshirt is total of P"+cost);
- System.out.println("Shipping fee:"+ship);
- cost1=cost+ship;
- System.out.println("Your cash:");
- pay = h.nextInt();
- change = pay-cost1;
- System.out.println("Your cash is "+pay+ " and the change is "+change);
- System.out.println("Your Order Minimalist Tshirts plus shipping fee is total of P"+cost1);
- System.out.println("THANK YOU FOR SHOPPING!!!");
- }
- catch(InputMismatchException imeRef){
- System.out.println("Exception"+imeRef.toString());
- }
- catch(Exception e){
- System.out.println("Exception "+e.toString());
- }
- System.out.println();
- break;
- }
- }
- break;
- }
- //Case C, IT SHOWS THE STOCK LEFT OF UNSOLD ITEM
- case 'C':{
- update();
- stock=plainStock-order2;
- stock=minimalStock-order6;
- stock=overStock-order4;
- stock=animeStock-order5;
- stock=poloStock-order1;
- stock=cropStock-order3;
- break;
- }
- case 'D':{
- System.out.println("ABOUT US");
- System.out.println("We serve good quality products.We assure that you cannot regret it."
- +"JAYHEJKGRGJECKRJGMRJHGJR"
- + "JHJRHCGIRUHCGNREHCIWCMR ");
- System.out.println();
- break;
- }
- case 'E':{
- address();
- break;
- }
- //default :
- //System.out.println("!!!Sayup Wala sa choice imong gipili!!!");
- //System.out.println();
- // break;
- }
- }while(choiceMain!='F');
- }
- public static void mainMenu() {
- System.out.println("A. HOME");
- System.out.println("B. SHOP");
- System.out.println("C. UPDATE");
- System.out.println("D. ABOUT");
- System.out.println("E. ADDRESS BOOK");
- System.out.println("F. EXIT");
- try {
- System.out.println("Enter your choice: ");
- choiceMain = h.next().charAt(0);
- }
- catch(InputMismatchException imeRef){
- System.out.println("Exception "+imeRef.toString());
- }
- catch(Exception e){
- System.out.println("Exception "+e.toString());
- }
- }
- public static void SHOP() {
- System.out.println("\t\t\t>>>Welcom to JMJ TOPS<<<");
- System.out.println("\t\t\t\tPRODUCTS");
- System.out.println("\t\t1.Polo Shirts");
- System.out.println("\t\t2.Plain Tshirts");
- System.out.println("\t\t3.Crop Tops");
- System.out.println("\t\t4.Oversize Tshirt");
- System.out.println("\t\t5.Anime Tshirts");
- System.out.println("\t\t6.Minimalist Tshirts");
- try {
- System.out.println("Select a Product Category: ");
- }
- catch(InputMismatchException ime){
- System.out.println("Exception "+ime.toString());
- }
- catch(Exception e){
- System.out.println("Exception "+e.toString());
- }
- }
- public static void update() {
- System.out.println(">>>>STOCK UPDATE<<<<");
- System.out.println("Plain Tshirt left ="+(plainStock-order2));
- System.out.println("Polo shirt left ="+(poloStock-order1));
- System.out.println("Minimalist left ="+(minimalStock-order6));
- System.out.println("Oversize Tshirt left ="+(overStock-order4));
- System.out.println("Anime Tshirt left ="+(animeStock-order5));
- System.out.println("crop-top shirt left ="+(cropStock-order3));
- System.out.println();
- }
- public static void address(){
- String name;
- String address;
- int contact;
- try{
- System.out.println("Your Name:");
- name = h.nextLine();
- name = h.nextLine();
- System.out.println();
- System.out.println("Your contact number:");
- contact = h.nextInt();
- System.out.println();
- System.out.println("Your Address:");
- address = h.nextLine();
- address = h.nextLine();
- System.out.println();
- System.out.println("\t>>>SHIPPING INFORMATION<<<");
- System.out.println();
- System.out.println("\tName of customer: "+name);
- System.out.println("\tCustomer contact number: +63"+contact);
- System.out.println("\tCustomer Address: "+address);
- System.out.println("Your Order is total of P"+cost1);
- System.out.println("AGAIN MAAM and SIR, THANK YOU FOR SHOPPING...........");
- System.out.println();
- }
- catch(InputMismatchException imeRef){
- System.out.println("Exception"+imeRef.toString());
- }
- catch(Exception e){
- System.out.println("Exception "+e.toString());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment