Computer Science 523
Advanced Programming
Summer 2014, The College of Saint Rose
In this week's lab, you will practice defining and using custom classes.
You may work alone or with a partner on the programming portions of this lab. Only one submission per group is needed.
Getting Set Up
To get your BlueJ environment set up for this week's lab assignment, start BlueJ and choose "New Project" from the "Project" menu. Navigate to your folder for this course and choose the name "Lab3" (no spaces) for the project.
Create a document where you will record your answers to the lecture assignment and lab questions. If you use plain text, call it "lab3.txt". If it's a Word document, you can call it whatever you'd like, but when you submit, be sure you convert it to a PDF document "lab3.pdf" before you submit it.
Lecture Assignment Questions
We will usually discuss these questions at the start of class on the lab due date, so no credit can be earned for late submissions of lecture assignment questions.
So for an item that costs $12.99 and weighs 6 ounces, the shipping cost is computed as $0.75 + 6 * $0.25 = $2.25. For an item that costs $150.00, shipping costs $0.00.
Also write calls to the method that compute the shipping costs for the 2 above examples, placing the results in variables named cheapItem and expensiveItem. (3 points)
Practice Programs
Programming Assignment: Tracking Student Grades
Your programming task for this week is to write a program, using a custom class, to extract and print some information from a file of student grading data.
Your program will read a list of student grading information from a file which contains one student's information per line. Each line will consist of a single word name, followed by 3 numbers representing scores on labs, a midterm exam, and a final exam. You may assume there is at least one valid line in the file, but your program should work for any non-zero number of lines. The only prompt you should issue and the only information you should supply to your program using the keyboard is the name of the file that contains all of the student information.
As you read the lines from the file, your program should keep track of the student who has the first name alphabetically, and the highest and lowest score in each category, and the highest and lowest total score (the sum of the three categories). At the end, print out the information for the student whose name/scores was the "winner" in each category. As we did in the class example for items purchased, you should break ties for the "lead" in any category by using the first student with that value for the category.
For example, given the following input file:
Brad 87 45.8 100 Alice 21 11 12 Greg 23 88 32 Bonnie 83 92.8311 88 Jeannie 77 77.77 77.77 Roberta 98 92 100 Cora 95 94.923 90
an appropriate output would look like:
First student, alphabetically: Alice, labs: 21.00, midterm: 11.00, final: 12.00, total: 44.00 Student with the lowest labs score: Alice, labs: 21.00, midterm: 11.00, final: 12.00, total: 44.00 Student with the highest labs score: Robert, labs: 98.00, midterm: 92.00, final: 100.00, total: 290.00 Student with the lowest midterm score: Alice, labs: 21.00, midterm: 11.00, final: 12.00, total: 44.00 Student with the highest midterm score: Cora, labs: 95.00, midterm: 94.92, final: 90.00, total: 279.92 Student with the lowest final score: Alice, labs: 21.00, midterm: 11.00, final: 12.00, total: 44.00 Student with the highest final score: Brad, labs: 87.00, midterm: 45.80, final: 100.00, total: 232.80 Student with the lowest total score: Alice, labs: 21.00, midterm: 11.00, final: 12.00, total: 44.00 Student with the highest total score: Robert, labs: 98.00, midterm: 92.00, final: 100.00, total: 290.00
Notes:
Submitting
Before 4:30 PM, Tuesday, June 10, 2014, submit your lab for grading. There are two things you need to do to complete the submission: (i) Copy your file with the answers to the lecture assignment and lab questions into your project directory. Be sure to use the correct file name. If you prepared your answers in Word, export to a PDF file and submit that. (ii) Upload a copy of your lab (a .7z or .zip file containing your project directory) using Submission Box under assignment "Lab3".
Grading
This assignment is worth 100 points, which are distributed as follows:
> Feature | Value | Score |
Lecture assignment questions | 25 | |
SavingsAccount correctness | 5 | |
SavingsAccountSimulator correctness | 5 | |
SavingsAccountMonth correctness | 5 | |
Coin class correctness | 7 | |
Coin main method correctness | 3 | |
StudentGrades instance variables | 3 | |
StudentGrades constructor(s) | 2 | |
StudentGrades accessor methods | 3 | |
StudentGrades toString method | 3 | |
GradeTracker reads file name from keyboard | 1 | |
GradeTracker correct file I/O | 2 | |
GradeTracker processes one student | 2 | |
GradeTracker processes multiple students | 3 | |
GradeTracker correct answer in each category | 9 | |
GradeTracker report all answers at the end | 4 | |
GradeTracker keeps references only to current leaders | 3 | |
StudentGrades/GradeTracker comments | 5 | |
StudentGrades/GradeTracker good names and declarations | 3 | |
StudentGrades/GradeTracker formatting | 2 | |
Lab question | 5 | |
Total | 100 | |