|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
0 {1 R+ g/ Y \- |1 q9 S: Y Z4 DShanghai - 2007# U- N! K/ { a4 x/ F6 Z
Assignment 26 g f- Q9 H( U3 L0 A
Deadline for Submission: 10:00 pm (Shanghai time), Tuesday 15th May 2007 Assessment Weighting: 20% of the total assessment for BSA104 Assignment Type: Individual Scenario: The teaching staff at a nearby university are concerned that some of their students are submitting other students‟ work. They need a simple Java program that will compare the text of two other Java programs, line by line, for equality, and then print out the results, and a recommendation. Requirements: Consider the three Java Classes: ProgramCompareMenu.java, ProgramCompare.java and AuthorisedUsers.java, available from the Assignment 2 page on Vista. You are required to perform the following tasks: The ProgramCompareMenu class: (Total maximum 20 marks available)! W, F8 D2 R3 w2 G- U7 t
1. Provide a basic text-based menu interface to the ProgramCompare class so that it can be used by two staff members to determine if the two supplied Java programs are the same or similar.5 h# {/ ~: x8 Z4 c( h5 r4 H
The staff must be able to:. b6 V* Z1 {/ l& e# J0 {2 E3 q2 j+ w
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
{4 h* U: [+ Z6 T1. The user should not be able to use the „system‟ until they have provided the correct user name and PIN combination. You should give them a second or third chance to get it right before shutting the „system‟ down.6 d* N' }1 w' F% T
 The interface should provide a menu so that the staff can:
8 W; | r# C9 @2 y+ ~+ V: wa) Enter the names of the two Java program files to be compared9 H4 y2 t9 h0 l; k# j
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.% a# n0 w- Y0 N$ a. A9 L
** You must use the two user names and PINs provided in your individual data available from the Assignment 2 page on Vista (see requirement 5 below). The user names and PINs should be included in your code, and the output to the screen should prompt the user with the user names and passwords (for marking purposes).
3 M0 t6 |7 a9 nBSA104 Business Programming – 2007: Assignment 2
/ _2 s% ]3 o! N- h0 d9 pPage 2 of 5% M5 ^5 o* ~5 u! h* s1 @% U' R
b) Print out to the screen all the lines of code that are the same
) w& h* C- {( t- T' g6 a; `, } Include the name of the file and the line number of the code being printed for each of the two files" x" {+ \; z; b- S
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared/ G5 u0 H K' M& n# v5 S& U
 the name, username and department of the user
) E3 h3 N0 A; r$ {7 } the statistics of the comparison3 I( J. F" o) v+ Z+ k$ p/ d
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different- g5 {% b3 k9 g) o. |! K
 the recommendation for further checking l" X( Q) _& t% w
- For example: if more than 5 (five) lines of code are the same in each Java program file, then print a recommendation to the screen that the staff member check the files more closely
! g) J* O6 w; f- a. L; r2 B. { H the names of the two files compared6 e9 D2 L) L5 J& x
d) Leave the program (exit)
: e% Q0 M0 N x5 v! m1 [9 N3 q6 kThe ProgramCompare class: (Total maximum 20 marks available). e. t" ~( v" W& U% }0 w6 Y
2. Provide a method/s to read in each line of code from the two files identified by the user: (assumed that the two Java program files are in the same folder as your program)
) T. O3 G8 `0 M& Pa) provide an error message if the files are not found or there is a problem opening them5 M: [0 h& C' w0 e; B
b) compare each line of code& a3 P8 [- G6 w" t
c) print out the lines that are the same
8 e8 J9 }3 C: Z' F$ F8 K* k9 \d) count the number of lines compared / lines the same
. N2 q" }; N* |& s$ n1 W' LThe AuthorisedUsers class: (Total maximum 20 marks available)
2 G9 h! k$ U* d5 E* y8 C3 m7 H3. Provide an object that contains the name, username, PIN, and Department of the authorised users of the program (user names and PINs as provided in your individual data - see requirement 5 below)2 X3 T# }. t+ S! S& q( ]
4. Provide methods to:. }" P$ O/ l l
a) compare the stored username and PIN with the one entered by the user - return a value that indicates whether they match or do not match# Y* v7 Q) e5 u+ i
b) return the name of the authorised user7 S5 s* ^& w& m/ V
c) return the name of the department of the authorised user0 Y, m" \9 |* }3 g1 y6 T
Individual Data (Maximum 20 marks available)9 l2 S, P- D7 R& k+ H# `% \
5. You will be given two staff member names, usernames, PINs, and department name, plus a set of two Java program files to compare using your program. You will need to log onto the BSA104 Assignment 2 page on Vista to generate your individual data and instructions for this requirement. You will need to use your University of Tasmania (UTas) student number.
7 S" h0 }% V) r W; m" I/ ?Documentation (Maximum 10 marks available)! t3 G$ S% U+ }2 Z/ X% j
6. Your program files should be fully documented, at least to the same standard as demonstrated in the textbook. This includes in-code comments, descriptions, and where appropriate, explanations for each new constructor, method and variable./ b4 N ]" U: e, c: R7 w7 c
BSA104 Business Programming – 2007: Assignment 2! _6 C/ T4 N6 @6 Q7 d9 z- o5 Q
Page 3 of 5 |
|