|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
/ o% o3 Z; K ?. C: MShanghai - 2007: y( w+ n6 C- w; N1 ^/ F9 Q
Assignment 2
2 F- x8 e) t; N. G8 D1 hDeadline 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)
7 o8 M1 F6 S" o# P- V. f" k: s1 ~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.9 O+ ~! V4 d) _# ?- V! o
The staff must be able to:, m2 i* C8 Q9 `! @1 q$ U8 l
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **., b' s! R4 u" _- \5 S" T" p% Y) V) y
1. 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.
7 k3 b9 @, l$ i/ f The interface should provide a menu so that the staff can:
2 a, _* k' n2 [! r( Z' oa) Enter the names of the two Java program files to be compared+ |1 Z- Q* o3 D$ }$ P
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.0 c3 M7 S9 n- ^4 _1 t% v Y
** 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).
/ I2 E! a9 J# F# }6 jBSA104 Business Programming – 2007: Assignment 2% {6 y' y2 B$ O; |& t5 F6 d
Page 2 of 5
! U, w" @1 W, g \1 ~9 Xb) Print out to the screen all the lines of code that are the same
; A5 K) n( H1 o8 D, A Include the name of the file and the line number of the code being printed for each of the two files
. _& o8 V9 H2 e! Y5 f1 Gc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared' T$ z5 F% `( \, [- A
 the name, username and department of the user
3 g# s1 s# e0 ]! W a the statistics of the comparison
) H7 h/ Z) K! j9 M r7 t! F- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
/ c$ J3 Y% _- ^ the recommendation for further checking( f/ p4 n8 B4 f! ^7 e
- 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% M4 q2 M6 z1 J8 U5 H
 the names of the two files compared
) ?8 M1 X. `8 k8 x1 Xd) Leave the program (exit)5 E6 O' J# e2 t7 y0 }
The ProgramCompare class: (Total maximum 20 marks available)3 M, d) {% J2 E% v/ F
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)% I4 s$ Y+ X5 Y5 t6 N( Z. \
a) provide an error message if the files are not found or there is a problem opening them& v9 ^, ]4 H9 F X7 ^+ `
b) compare each line of code' V# N3 j4 X! X0 q. `0 J
c) print out the lines that are the same
3 |9 z& O( \( od) count the number of lines compared / lines the same
1 S) p% A$ q: V& [* hThe AuthorisedUsers class: (Total maximum 20 marks available)
& v- z# G% u- h) H, U3. 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)
( l3 w# |- W. n' W5 t% a4. Provide methods to:8 R; S0 w# ]4 @, m6 i
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 match0 W$ O) k3 g6 F" c: w
b) return the name of the authorised user
' @+ y0 W4 ?+ U9 P8 pc) return the name of the department of the authorised user" S8 S# R$ n( V2 L3 m: Y+ @
Individual Data (Maximum 20 marks available)* a' M, B! n6 o! B
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.
/ r, J" x3 p+ e, TDocumentation (Maximum 10 marks available)+ w# X7 ~4 R; r2 E0 I: a: D
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.
) z( S2 _0 k G8 TBSA104 Business Programming – 2007: Assignment 2
; C7 I/ v6 z i# @ j5 c. @Page 3 of 5 |
|