|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming2 v. t$ }( o9 D* I ^" }
Shanghai - 2007
2 B$ Z' z% h7 u0 @Assignment 2& ]; o0 z4 S2 I! {$ Q
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)
2 f, ~" U( P; b( o1. 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.+ M" M- E6 |* m' B
The staff must be able to:6 w; D( D1 U. C
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
' y/ O3 ?5 D- {- ~5 j4 \' `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.( R- \1 ~0 ^/ s2 O7 @/ \% F' e/ y: ]
 The interface should provide a menu so that the staff can:2 p" j* N) k' T* P* y8 V2 B
a) Enter the names of the two Java program files to be compared5 s/ g) F) d. Q! a% U7 o
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.. E- Y" x8 b6 q) W/ T9 ~9 f( C
** 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).' `% C9 g3 k0 b2 C$ H& ]- I
BSA104 Business Programming – 2007: Assignment 2
0 R/ J& J- b8 ~# o9 u" VPage 2 of 5; x0 R1 A; V( r9 X" t" {
b) Print out to the screen all the lines of code that are the same
3 X$ t4 |9 h4 a- l5 H: k Include the name of the file and the line number of the code being printed for each of the two files ^( R6 q4 `' s! P+ n
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared% O. ^3 C; a! k. W
 the name, username and department of the user
) `. Q+ P `# L' x) z# f; V the statistics of the comparison
1 \8 G+ x! L3 x5 p! B3 D- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different) B: z; }2 x( q( j( ~
 the recommendation for further checking
" B9 @: N# {( {0 [+ l* ^ Q* p% K- 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
' ~: k; \" M3 I/ ?" U1 O- o' m7 { the names of the two files compared/ I* E# Q! X, r, ]
d) Leave the program (exit)
# X* f; X$ s# |The ProgramCompare class: (Total maximum 20 marks available); ?2 i* w/ x$ Y1 g, u0 g4 X
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)4 u7 O/ v7 g4 l2 [0 i% E/ S, `, B( H
a) provide an error message if the files are not found or there is a problem opening them5 Q6 w2 s3 ?; d/ p- D
b) compare each line of code$ i6 D: x- b, e8 T/ b# n6 a8 N/ G
c) print out the lines that are the same! o( L+ ~* W- N3 _ w
d) count the number of lines compared / lines the same& _2 T% Y! Q% r4 m
The AuthorisedUsers class: (Total maximum 20 marks available)5 n& }: S( X0 ?4 k/ I) s* g; M
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)
8 P2 u K) ]% `& h2 o4. Provide methods to:
" x1 X! N6 n( o a# x, Z8 Va) 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
( f3 r3 G* j2 Z# B" U/ qb) return the name of the authorised user6 ]& X3 I( r- m7 t' ~" b
c) return the name of the department of the authorised user9 C" s4 C1 a! a% z2 I) l
Individual Data (Maximum 20 marks available)
8 }$ y/ |& b: r: u3 h f; B5. 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+ i; D6 }+ e% WDocumentation (Maximum 10 marks available)" T) b) R7 F2 S& A+ g1 s
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.
& n; y3 m/ } G8 nBSA104 Business Programming – 2007: Assignment 2
0 n! g& e9 |/ j" rPage 3 of 5 |
|