Advertisement
Guest User

Untitled

a guest
Jan 8th, 2013
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.37 KB | None | 0 0
  1. import java.util.Scanner;
  2. /**
  3.  * Write a description of class StudentDriver here.
  4.  *
  5.  * @author (your name)
  6.  * @version (a version number or a date)
  7.  */
  8. public class StudentDriver
  9. {
  10.    public static void main(String[] args)
  11.    {
  12.        Scanner reader = new Scanner(System.in);
  13.        Student student1 = new Student();
  14.        Student student2 = new Student();
  15.        Student student3 = new Student();
  16.        
  17.        System.out.print("What is your name? ");
  18.        String name = reader.nextLine();
  19.        student1.setName(name);
  20.        System.out.print("What are three numerical grades?: ");
  21.        
  22.        int t1 = reader.nextInt();
  23.        student1.setGrade(t1);
  24.                                                       // REFERENCES THE STUDENT CLASS
  25.        
  26.        student2.setName("Snarfam the Wizard");
  27.        student2.setGrade(99, 56, 84);
  28.        
  29.        student3.setName("Stefan Howansky");
  30.        student3.setGrade(73, 78, 81);
  31.        
  32.        System.out.println(student1.toString());
  33.        System.out.println("\n" + student2.toString());
  34.        System.out.println(" ");
  35.        System.out.println(" ");
  36.        System.out.println("Is student 1 the same as student 2?:" + "\n" + student1.compareStudent(student2));
  37.        System.out.println("Is student 1 the same as student 3?:" + "\n" + student1.compareStudent(student3));
  38.      
  39.        
  40.      
  41.  
  42.    }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement