1. Login to UNIX
2. Create and edit a file called 'LabX.java' (substitute the lab number
for X- where is the number of the lab- such as 'Lab1.java') in Pico, then compile and run the program.
Do the following:
- Write a program which demonstrates object-oriented programming.
- This program will consist of two classes: student and lab13.
- The student class will have a constructor which will take:
- An int number between 1 and 9999 (inclusive) which is the student ID.
- A string which is the name of the student. This string must be at least 3 characters long.
- A double number which is the GPA of the student. This number must be in the range 1.0 to 4.0 inclusive.
- The student class must have all the get and set methods as well as the equals and toString methods.
- The lab13 class (within the main method) should take the following actions:
- Create three students:
1111 Christina Aguilera 3.7
2312 Eminem 1.3
6734 Elvis Presley 2.3
- Print all students using the toString method.
- Change the first student name from Christina Aguilera to Shakira
- Change the second student GPA from 1.3 to 1.0.
- Print all the students (again) using the toString method.
- Calculate the GPA average of all the students.
- All information in the lab13 class is hardcoded and can all be done from the main method.
- Note: If the program doesn't compile or if the program crashes
you will get no credit
- Use javadoc style to write your program:
Refer to the Java Coding Standard and make sure your code adheres to its
rules.
3. Get into Pine and attach the file to an e-mail and send the e-mail /
file to the ics111-lab@hawaii.edu account.
- Your e-mail should have the following subject: labX / lastname /
section (X should be substituted for the lab number [such as lab 1], lastname should be substituted for your lastname, section
should be substituted with the A for the afternoon section and M for the
morning section) Not following this standard will result in a deduction
of points.
- control <J>, then control <T> allows you to browse and pick the file that you wish to attach
4. Check the webpage to make sure that the e-mail arrived.
Here is the URL:
http://www2.hawaii.edu/~tp_200/bmf/ics111-lab.html
5. Once I (TA) get the e-mail in my account AND I can verify it on the web,
you will receive your lab participation point. For
grading policies on your lab, click here...
6. Hints.
You will not be reading from the user in this assignment.
The lab13 class is created the same way as in all previous labs. The only difference is that you must create a student class and perform operations on it.
Link to the Java
API - to look up any methods of any class you would like to use.
Link to the
Java Coding Standard - to look up Java code formatting rules.