Project 03

 

Overview

This is a modified version of the previous project. Instead of using three related arrays to maintain data about a group of students, it must define an instantiable Student class and maintain student data using an array of Student object references.

 

The Student class

Within the App.java source file and after the closing brace of the App class, define an instantiable Student class. The class must contain:

The "set" method that stores the student's name must receive a String and store it if it isn't empty. Nothing must be returned to the caller.

The "set" method that stores the student's major must receive a StringBuffer and store it if the value of its string is "CIS", "MGT", "MKT", "ACT", or "none". Otherwise, nothing should be stored. The method must return a boolean to indicate whether the data it received was valid.

The "set" method that stores the credits earned must receive an int and store it if the value is greater than or equal to zero. Otherwise, nothing should be stored. The method must return a boolean to indicate whether the data it received was valid.

 

The App class

This class will define application processing as follows:

Student Name

Major

Credits Earned

Senior

------------

-----

--------------

------

McKinley

none

23

No

Roosevelt

MGT

110

Yes

Taft

CIS

65

No

Be sure to use the isSenior() method to determine if the student is a senior.

After displaying all the student information, call the pressEnterKey() method of my Utility class, and then return to the main menu.

To achieve the above format, use the overloaded printField() method of my Utility class to build each line of output. One form of the method automatically right-aligns a String within a field of a specified width. For example, if amount is a double variable having the value 12.5, the statements

Utility.printField(20, "Distance");
Utility.printField(20, "" + amount);

would display

            Distance                12.5

Notice that the second statement concatenates to an empty string literal to force the result to be a String.

  1. Exit. If selected, display an appropriate termination message, call the pressEnterKey() method of my Utility class, and then end the program.

If the user enters an invalid menu choice, display an appropriate error message, call the pressEnterKey() method of my Utility class, and re-display the menu.

 

Miscellaneous 

 

Grading criteria

Your program will be worth 30 points to be awarded as follows:

 

Submission

E-mail me the contents of your App.java source file no later than midnight on the program due date. If you are using JBuilder 4 and the Test project previously copied from the College of Business network, this file will be in the src folder of the project. In the College of Business labs, the complete path of your source file is:

D:\Test\src\App.java

To verify that you are doing this properly, e-mail to yourself, copy the source code to your test project, and re-test the program. If it works for you, it will probably work for me.

Upon receipt of your project, I will send you a verification message. When your project has been graded, you will receive an e-mail with your project score and comments (based on the above criteria). All project scores will be posted on the Internet within a few days after the due date.