Advertisement
feagans

Untitled

Apr 6th, 2014
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. public static int[] get_av_students() {
  2. int av_students[] = new int[9];
  3. for(int i = 0; i < 9; i++)
  4. {
  5. int hour = (10 + i)%12;
  6. if ( hour == 0 ) {
  7. hour = 12;
  8. }
  9. while (true){
  10. try{
  11. av_students[i] = Integer.parseInt(JOptionPane.showInputDialog(null, "Average Students "+hour+":00"));
  12. if (av_students[i] < 0) {
  13. JOptionPane.showMessageDialog(null,"No Negative Entries");
  14. continue;
  15. }
  16. }
  17. catch (IllegalArgumentException e) {
  18. JOptionPane.showMessageDialog(null,"Entries Must Be Numbers");
  19. continue;
  20. }
  21. break;
  22. }
  23. av_students[i] = Integer.parseInt(JOptionPane.showInputDialog(null, "Average Students "+hour+":00"));
  24.  
  25. }catch (IllegalArgumentException ex) {
  26. JOptionPane.showMessageDialog(null, " NO NEGETIVES ALLOWED ");
  27. }
  28. return av_students;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement