|
|
|
|
||
|
|
Classes and Object Oriented
Programming, Part II |
|
||
|
|
Introduction |
|
||
|
|
A teacher wants a program
that will keep track of grades for students.
Each student will be describe by a name a
student ID number and at least three test scores. The constructor for the Student class will
have two parameters, name and ID.
There will also be several methods including inputGrades,
getAverage, toString
as well as getter methods and mutator methods that
allow the user to edit the data. All classes have a default
"toString" method which can be called by simply concatenating
the object variable to a string. In
this exercise you are going to overwrite this method to out put your data to
the driver program |
|
||
|
|
|
|
||
|
|
|
|
||
|
|
|
|
||
|
|
Programming Assignment Write a class named
Student that describes different types of grades (at least 4). These attributes should be the basis of the
private variables of the class. Define
a "getter" method for each attribute and a constructor that has
parameters that allow for the input of data into the class variables. The
Student class should be similar to that which has been stubbed out above, Use an input
dialog box for user input. I Write a user or client
program for your Student class. Create
five instances of students based upon data supplied by you. Display the attributes of each student in a
message dialog box using the getter methods.
Calculate the average grade of the students using a user defined
method. Use a message dialog box for
output from the program. Turn
in a program listing your source code.
Source code should use proper formatting. Also turn in a copy of your output as in
previous assignments. This can be
obtained by running the program and then using AltPrintScreen
to copy the window of the output onto the clipboard. Then paste the contents
of the clipboard into WordPad and print out the document. In addition to the source code, the output,
also turn in the answer to the questions listed below. |
|
||
|
|
|
|
||
|
|
|
|