|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming1 |" v. A5 L; \: v8 V
Shanghai - 2007
* U" y( W% E8 d# S* e! Q8 L* }. sAssignment 2
8 c' o& @$ z6 g# QDeadline 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)# N# q# ]$ ^" A2 Q) t, c& k
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.
0 E& r; ^( Z) i, Y# _; {7 R. [0 t: a0 WThe staff must be able to:
; N5 N/ p) Q( v' N" M. e$ v Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.6 I& y- u0 ]1 { v3 O1 D5 H
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.0 N3 u% i! j$ g1 u8 n
 The interface should provide a menu so that the staff can:
" h; U: d3 w6 `; \7 `a) Enter the names of the two Java program files to be compared
4 |; {0 E! s% b4 k- h$ t( C; w8 d* f For this assignment, it will be assumed that the two Java program files are in the same folder as your program.) p" i/ U( p" r1 T" Z, o
** 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 Z+ l5 J0 T$ H: W/ R; H+ g
BSA104 Business Programming – 2007: Assignment 2
) B, n' t+ l/ x2 a0 @/ j( v* g/ jPage 2 of 5- s" u: V& S) Z4 a) l. C9 w4 z8 {
b) Print out to the screen all the lines of code that are the same# [+ u3 P+ l) v2 b' u8 W+ i
 Include the name of the file and the line number of the code being printed for each of the two files
$ \ {. k2 ] |, lc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared6 P. `2 @$ q# b" d" Z% \$ K
 the name, username and department of the user
5 N b! I m. x4 Z the statistics of the comparison/ ~4 Q7 t. q/ P
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
' f S8 a+ X* N0 L' Z) D. _( d% L the recommendation for further checking
( t: g+ e S( A) B- x J- c1 ]! ]; C- 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+ W0 C' O0 U; _* t
 the names of the two files compared" L+ r% F! _+ w) Z9 S
d) Leave the program (exit)
2 u8 `: C: A U7 w/ V- iThe ProgramCompare class: (Total maximum 20 marks available)
0 i4 R# s7 Y* U' b' ^+ `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); R, M( m$ \% ^- W0 z
a) provide an error message if the files are not found or there is a problem opening them
' F) P" r2 j! }b) compare each line of code, E, q# ]* }% W3 a) R5 @4 f. p
c) print out the lines that are the same
* B {- O5 i- ?5 Q1 `' H" R8 d+ {d) count the number of lines compared / lines the same
; s# d, g. g! N# f0 mThe AuthorisedUsers class: (Total maximum 20 marks available)$ ^# N7 {+ u8 Q. K4 Y7 c: J
3. 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)- a* _9 |0 W! _/ E0 Q# F2 y/ e
4. Provide methods to:
. B$ t1 T( [& Q/ {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 match2 v8 R! ^3 }, C" K/ s! ]. ?
b) return the name of the authorised user
2 H* b7 o% g k# y2 y Oc) return the name of the department of the authorised user
( D% v: h9 E0 e' _% x1 I- MIndividual Data (Maximum 20 marks available)
6 V% y2 b1 ]# ^0 r* H9 n1 a5. 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.+ N' \1 q# L% f' b* W* H
Documentation (Maximum 10 marks available)
; w4 s' _% |+ L1 @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.
# z6 ]+ U7 s+ N' y$ wBSA104 Business Programming – 2007: Assignment 2
0 Q4 m& ], l5 k1 X9 P# ^' \Page 3 of 5 |
|