Java Student Project         


Student
Ability Level: Intermediate  
Estimated Time: 50 minutes
Objectives:
  • How to use AND and OR operators 
  • How to use the switch statement
  • How to use the conditional operator
  • How to use the NOT operator
  • More about operator precedence
Materials & Resources:
  • Java Software
  • Textbook
Overview: Create a Student class that includes the student’s name and grade point average. Include an output method.  Create a subclass for matriculated students that also outputs the student’s major. Create a program that demonstrates both of these classes.
Instructions:  See the notes in overview above.
Hints: Some important points to keep in mind in doing this project:

You can place and indent the if following an else, but a program with many nested if…else combinations soon grows very long and “deep,” and with indentations, later statements in the nest would move farther and farther to the right on the page.  For easier-to-read code, Java programmers constantly place each else and it’s subsequent if on the same line.

Sample Code:

import java.io.*;

public class Student
{
    //This class will declare all the attributes of a
    //"Student"


    public void printStudent()
    {
        //SAMPLE FUNCTION OF THIS CLASS: to print out basic
        //information about the student

    }

}

class Matriculated extends Student
{
    //Class that adds on to the original "Student" class when
    //the student has a major

}

class UseStudent
{
    //Prints out programmers info and uses all functions
    //above to utilize program

}