Ok, I'm very bad at java and I was wondering if anyone could explain to me how I would begin to approach this?

This problem involves a system which processes medical insurance forms. The forms have a three byte code which starts with a first character alpha code of a ‘U’, ‘C’, or ‘P’ (standing for unclassified, confidential or proprietary). This is followed by 2 digits whose values range from 01-25. Create a program that makes an exception class called InvalidCodeException to be thrown when an improper code is entered. If the document processing encounters an invalid alpha code print a message and the document, then continue processing the next insurance form. If the numeric designation of the document is not between 1 and 25, throw a different Exception message, the document, and continue processing the next document. Also make sure you properly handle the numeric designation when it is not numeric. Display all valid documents. Your application should read this text file of insurance forms named MedInsForms with the fields: Code, Date, Procedure, and Charges (the fields are on one line separated by a blank.)

Create a new exception class as described.
Develop a method that validates code.
Develop a routine to read form, call the validate method and display the form if no exception.

Sounds like you'll have a method like this:

public class MedicalFormProcessor {
	public boolean isValidCode(String code) throws InvalidCodeException, InvalidDesignationException {
		// test 'code' for either parameter
		// return boolean

and Exception classes like this:

public class InvalidCodeException extends Exception {

.... // your code


You can read more about Exceptions here.

Edited 5 Years Ago by ztini: n/a

This article has been dead for over six months. Start a new discussion instead.