$10.00 Java I/O text (using eclipse)
- From Computer-Science: Object-Oriented-Programming
- Due on Aug. 02, 2112
- Asked on Jul. 30, 2012 at 11:18:43AM
Create a package named cs520.hw4.part2. Using this package, create the following classes.
1. Create a class named Student as follows. The class keeps track of the student’s homework grades.
a. The instance (or member) private variables – name (String), homework1, homework2, homework3, homework4, homework5 and homework6 (all of type integer).
b. A single constructor with name as its argument.
c. The public set methods for the six homework instance variables. The get methods are optional.
d. A public computeAverage method which takes no arguments and returns a double showing the average homework grade for this student.
e. Override the toString method to return the string representation of this object in the format “The ’s average grade is ”.
2. Create a Test class to test the following functionality in its main method.
a. Use the BufferedReader class to read the data.txt file. The contents of the file are shown below. Create the data.txt file in HW4_lastName.
b. Read the contents of the text file one line at a time using a loop. The program should work for any number of input lines. Invoke the processInputData method for each line read.
c. Write a private method processInputData which processes its string input argument as follows.
1. Tokenize the string argument using the StringTokenizer class using the comma as the delimiter.
2. Extract the name token. Create a Student object and assign to the variable currentStudent.
3. Read each homework grade token one token at a time. Use the corresponding set method on the student object to set the instance value.
4. Display the string representation of the currentStudent object to the console.
- This tutorial hasn't been purchased yet.
- Posted on Jul 30, 2012 at 5:41:22PM

Attachments:
[
cs520/hw4/part2/Student.java
cs520/hw4/part2/Test.java
]
- This tutorial hasn't been purchased yet.
- Posted on Jul 30, 2012 at 6:50:26PM

Attachments:
[
HW4_lastName/data.txt
HW4_lastName/hw4/part2/Student.java
HW4_lastName/hw4/part2/Test.java
HW4_lastName/screenshot.jpg
]
- This tutorial was purchased 1 time and rated A+ by students like you.
- Posted on Jul. 31, 2012 at 02:08:20AM

Attachments:
[
src/cs520/hw4/part2/Student.java
src/cs520/hw4/part2/Test.java
]
- This tutorial hasn't been purchased yet.
- Posted on Jul 31, 2012 at 4:56:10PM

Attachments:
[
cs520/.classpath
cs520/.DS_Store
__MACOSX/cs520/._.DS_Store
cs520/.project
cs520/.settings/org.eclipse.jdt.core.prefs
cs520/bin/cs520/hw4/part2/data
cs520/bin/cs520/hw4/part2/Student.class
cs520/bin/cs520/hw4/part2/StudentTest.class
cs520/src/.DS_Store
__MACOSX/cs520/src/._.DS_Store
cs520/src/cs520/.DS_Store
__MACOSX/cs520/src/cs520/._.DS_Store
cs520/src/cs520/hw4/.DS_Store
__MACOSX/cs520/src/cs520/hw4/._.DS_Store
cs520/src/cs520/hw4/part2/.DS_Store
__MACOSX/cs520/src/cs520/hw4/part2/._.DS_Store
cs520/src/cs520/hw4/part2/data.txt
cs520/src/cs520/hw4/part2/Student.java
cs520/src/cs520/hw4/part2/StudentTest.java
]
- This tutorial hasn't been purchased yet.
- Posted on Jul 31, 2012 at 7:30:14PM

Attachments:
[
cs520/hw4/part2/Student.java
cs520/hw4/part2/Test.java
]