Advertisement
Guest User

Untitled

a guest
Nov 22nd, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. import java.util.Arrays;
  2. import java.util.Scanner;
  3. /**
  4. * between 0 and 100.
  5. * @author 14salakot
  6. * 28/09/17
  7. */
  8.  
  9. public class L06FavouriteSubjects
  10. {
  11.  
  12. public static void main(String[] args)
  13. {
  14. Scanner iKeyboard = new Scanner (System.in);
  15. Scanner szKeyboard = new Scanner (System.in);
  16. int iNumOfArray , i , iNum = 1;
  17. String[] szArray;
  18.  
  19. System.out.print("How many of your GCSE subjects do you enjoy? ");
  20. iNumOfArray = iKeyboard.nextInt();
  21.  
  22. szArray = new String[iNumOfArray];
  23.  
  24. for(i=0; i!=iNumOfArray; i++)
  25. {
  26. System.out.print("Enter subject. "+iNum+ " ");
  27. szArray [i] = szKeyboard.nextLine();
  28. iNum++;
  29. }
  30.  
  31. System.out.println("You enjoy following subjects: ");
  32.  
  33. iNum = 1;
  34. for(i=0; i!=iNumOfArray; i++)
  35. {
  36.  
  37. System.out.println(iNum+". "+szArray[i]);
  38. iNum++;
  39. }
  40. }
  41.  
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement