Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2015
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class Assignment33
  3.  
  4. {
  5. public static void main (String[] args)
  6. {
  7. Scanner input = new Scanner (System.in);
  8. int productCounter1 = 0;
  9. System.out.print("Enter product numbers in the range 1-5, then enter the value -1 to terminate: ");
  10. int products = input.nextInt();
  11. while ( input.nextInt() != -1)
  12. {
  13. switch (products)
  14. {
  15. case 1:
  16. ++productCounter1;
  17. break;
  18. }
  19. }
  20. System.out.print("Product 1: " + productCounter1);
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement