Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- public class SalesManager{
- public static void main(String[] args){
- List<Integer> week1 = new ArrayList<Integer>();
- List<Integer> week2 = new ArrayList<Integer>();
- int option;
- do {
- System.out.println("Please choose what you want to do by entering a number: \n");
- System.out.println("(1) Input last week's sales.");
- System.out.println("(2) Input this week's sales.");
- System.out.println("(3) Review weekly sales");
- System.out.println("(4) Remove last week's sales and replace with this week's sales.");
- System.out.println("(5) Exit.");
- Scanner input = new Scanner( System.in );
- option = input.nextInt();
- if(option == 1){
- System.out.println("Please enter your sales for Monday:");
- week1.add(input.nextInt());
- System.out.println("Please enter your sales for Tuesday:");
- week1.add(input.nextInt());
- System.out.println("Please enter your sales for Wednesday:");
- week1.add(input.nextInt());
- System.out.println("Please enter your sales for Thursday:");
- week1.add(input.nextInt());
- System.out.println("Please enter your sales for Friday:");
- week1.add(input.nextInt());}
- if(option == 2){
- System.out.println("Please enter this week's sales");
- System.out.println("Please enter your sales for Monday:");
- week2.add(input.nextInt());
- System.out.println("Please enter your sales for Tuesday:");
- week2.add(input.nextInt());
- System.out.println("Please enter your sales for Wednesday:");
- week2.add(input.nextInt());
- System.out.println("Please enter your sales for Thursday:");
- week2.add(input.nextInt());
- System.out.println("Please enter your sales for Friday:");
- week2.add(input.nextInt());
- }
- if(option == 3){
- System.out.println(week1);
- System.out.println(week2);
- }
- if (option == 4){
- week1.removeAll(week1);
- week1.clear();
- week1.addAll(week2);
- week2.clear();
- week2.addAll(week1);
- week2.removeAll(week2);
- }
- if (option == 5) {
- System.exit(0);
- }
- } while (option!=0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement