Guest User

вррпа

a guest
Feb 1st, 2016
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.91 KB | None | 0 0
  1. import javax.swing.*;
  2.  
  3. public class ReportCard {
  4.  
  5.     public char convertGrades(int testResult) {
  6.         char grade;
  7.         if (testResult >= 90) {
  8.             grade = 'A';
  9.         } else if (testResult >= 80 && testResult < 90) {
  10.             grade = 'B';
  11.         } else if (testResult >= 70 && testResult < 80) {
  12.             grade = 'C';
  13.         } else {
  14.             grade = 'D';
  15.         }
  16.         return grade;
  17.     }
  18.  
  19.     public static void main(int testResult) {
  20.         ReportCard rc = new ReportCard();
  21.         char grade = JOptionPane.showInputDialog(rc.convertGrades, "Введите");
  22.         switch (grade) {
  23.         case 'A':
  24.             JOptionPane.showMessageDialog(null, "Отлично!");
  25.             break;
  26.         case 'B':
  27.             JOptionPane.showMessageDialog(null, "Хорошо!");
  28.             break;
  29.         case 'C':
  30.             JOptionPane.showMessageDialog(null, "Удовлетворительно!");
  31.             break;
  32.         case 'd':
  33.             JOptionPane.showMessageDialog(null, "Неудовлетворительно!");
  34.             break;
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment