Your job for this lab is to write a program that prints out a check on the screen. Your program should ask the user to input the following pieces of data and then print out a nicely formatted check on the screen:
To begin: Copy the lab5 folder from
"M:\CLASSES\CS120\SECTION A" into your home directory. You
should now write a new Check class in a file called
"Check.java". The Check class should have a constructor that
takes as parameters the four pieces of information above and
stores them into fields of a Check object. Then, it should also
have a print() method that prints out the formatted
check on the screen.
I have already included some files in this folder to get you started. These files are:
main method that gets input, creates a
Check
object, and calls the print() method on the
object.
public static String spaces(int num)num
spaces. You might use this method using a statement like:
System.out.println(MakeSpaces.spaces(30) + "Date: " + date)
MakeSpaces.spaces(n) method described above.
Items in bold are what the user types in.
> java CheckDriver
Please enter check number: 489
Enter check date (mm/dd/yy): 9/30/2004
Enter recipient name: Berry College
Enter check amount: 4569.30
Nadeem Abdul Hamid 489
600 Redmond Rd
Rome, GA 30165
Date: 9/30/2004
Pay to the
order of: Berry College $4569.30
Four thousand five hundred sixty-nine dollars and 30/100 cents
Memo: _________________________ _______________________________________
|
Hand in a printout of your Check.java file and also upload it to the VikingWeb. If we run out of time in lab, you may finish up over the weekend and turn it in class on Monday, October 4 but no later than that.
