Lab 10

Purpose

The purpose of this lab assignment is to further your understanding of error checking. You will do some basic error checking and be introduced to exception handling. This will involve the try-catch statement. You will also do file reading and writing.

Key Reading

  • 10.1-10.6
  • review 5.6

Requirements

Part 1 - Enter 'em (10 points)

  • Write a Java application that will:
    • accept the name of a student
    • accept scores for each lab and each exam for the student
    • accept the total number of late days accumulated by the student for all labs assignments (negative numbers represent early days)
    • accept the total number of late days accumulated by the student for all exams
    • check to make sure each entry is in the valid range
    • check for erroneous input
    • not crash if invalid input is entered
    • allow for subsequent entry of valid input when invalid input has been entered. Your program should not require previously entered scores to be entered again if invalid input has been entered.
    • write each valid entry to a file (file name should be that of the student entered at the beginning of the program)

Part 2 - The Moment of Truth (10 points)

  • Create a second Java application that will:
    • read the lab scores, exam scores, and lab late day values from a file (user-given student name; assume the file is of the same format as is created in Part 1),
    • ask for a valid file name if an invalid file name is entered.
    • display the name of the student,
    • compute and display the total lab points, exam points, and number of late days accumulated by the student,
    • compute and display the final letter grade for the student.

Note: You must catch all applicable exceptions for both parts of this lab.

Requirement Notes

Overall

  • By "catching all applicable exceptions," we mean that you cannot use the throws statement for this lab. (Though you may use the throw statement if you choose.)
  • You do not need to deal with any extra credit besides what is earned through early days.
  • All scoring information is found on the course syllabus.

Part 1

  • Maximum scores for labs, exams, and late/early days are shown on the course syllabus.
  • Do not include extra credit as part of the maximum points for a lab.
  • Assume the minimum score for an assignment is 0.
  • "Erroneus input" is anything that is not a valid score for a particular entry (such as being outside the valid range or letters for numerical scores)
  • When creating the file remember to include an appropriate file extension

Part 2

  • An "invalid file name" is a file name that does not exist.
Designed by Andy Griffin