Advertisement
Guest User

Untitled

a guest
Nov 29th, 2015
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.88 KB | None | 0 0
  1. import java.util.*;
  2. public class SalesManager{
  3.     public static void main(String[] args){
  4.         List<Integer> week1 = new ArrayList<Integer>();
  5.         List<Integer> week2 = new ArrayList<Integer>();
  6.         int option;
  7.        
  8.             do {
  9.                 System.out.println("Please choose what you want to do by entering a number: \n");
  10.                 System.out.println("(1) Input last week's sales.");
  11.                 System.out.println("(2) Input this week's sales.");
  12.                 System.out.println("(3) Review weekly sales");
  13.                 System.out.println("(4) Remove last week's sales and replace with this week's sales.");
  14.                 System.out.println("(5) Exit.");
  15.  
  16.                 Scanner input = new Scanner( System.in );
  17.                 option = input.nextInt();
  18.               if(option == 1){
  19.                      System.out.println("Please enter your sales for Monday:");
  20.                      week1.add(input.nextInt());
  21.                      System.out.println("Please enter your sales for Tuesday:");
  22.                      week1.add(input.nextInt());
  23.                      System.out.println("Please enter your sales for Wednesday:");
  24.                      week1.add(input.nextInt());
  25.                      System.out.println("Please enter your sales for Thursday:");
  26.                      week1.add(input.nextInt());
  27.                      System.out.println("Please enter your sales for Friday:");
  28.                      week1.add(input.nextInt());}
  29.               if(option == 2){
  30.                      System.out.println("Please enter this week's sales");
  31.                      System.out.println("Please enter your sales for Monday:");
  32.                      week2.add(input.nextInt());
  33.                      System.out.println("Please enter your sales for Tuesday:");
  34.                      week2.add(input.nextInt());
  35.                      System.out.println("Please enter your sales for Wednesday:");
  36.                      week2.add(input.nextInt());
  37.                      System.out.println("Please enter your sales for Thursday:");
  38.                      week2.add(input.nextInt());
  39.                      System.out.println("Please enter your sales for Friday:");
  40.                      week2.add(input.nextInt());
  41.                     }
  42.                      if(option == 3){
  43.                      System.out.println(week1);
  44.                      System.out.println(week2);
  45.                     }
  46.                      if (option == 4){
  47.                      week1.removeAll(week1);
  48.                      week1.clear();
  49.                      week1.addAll(week2);
  50.                      week2.clear();
  51.                      week2.addAll(week1);
  52.                      week2.removeAll(week2);
  53.                     }
  54.                     if (option == 5) {
  55.                         System.exit(0);
  56.                     }
  57.                 } while (option!=0);
  58.             }
  59.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement