Advertisement
jaredt17

Chapter9Exercise

Dec 5th, 2014
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.33 KB | None | 0 0
  1. package person;
  2.  
  3. public class Student
  4. {
  5.  
  6.         int age = 10;
  7.         String s = "Jared's age is " + age;
  8.         int year = 1998;
  9.         String s1 = "Jared's year is " + year;
  10.         {
  11.                 Major Major = new Major();
  12.                 String s = Major.toString();
  13.                      
  14.         }
  15. }
  16.  
  17. package person;
  18.  
  19. public class Instructor
  20. {
  21.         int age = 35;
  22.         String s = "Justin's age is " + age;
  23.         int year = 1984;
  24.         String s1 = "Justin's year is " + year;
  25.      
  26.         {
  27.                 Salary Salary = new Salary();
  28.                 String s = Salary.toString();
  29.                    
  30.         }
  31. }
  32.  
  33.  
  34.  
  35.  
  36. public class AnyCorrectChoiceQuestion
  37. {
  38.  
  39.          private String text;
  40.          private String answer;
  41.        
  42.          public AnyCorrectChoiceQuestion()
  43.          {
  44.          text = "";
  45.          answer = "";
  46.          }
  47.  
  48.          public void setText(String questionText)
  49.          {
  50.          text = questionText;
  51.          }
  52.  
  53.      public void setAnswer(String correctResponse)
  54.          {
  55.          answer = correctResponse;
  56.          }
  57.  
  58.          public boolean checkAnswer(String response)
  59.          {
  60.          return response.equals(answer);
  61.          }
  62.  
  63.          public void display()
  64.          {
  65.          System.out.println(text);
  66.          }
  67.        
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement