|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
, _# I; S7 ^- D9 B+ `, |4 c/ D0 XShanghai - 2007 I# t% k/ d& i. c
Assignment 2
) t/ Z( m9 C3 M% DDeadline 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), f, {$ z+ _# l! P0 u4 S; x! 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.
~( \3 j9 `' N, h/ @% A7 [, @" YThe staff must be able to:& K3 m; P* K" h1 }% }! b8 o1 K" F- u% Y
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
8 b) c: s4 t+ k, ?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 o4 m. F1 r4 C& x3 l7 P* D The interface should provide a menu so that the staff can:% u" r" N! _% v$ A6 t2 j
a) Enter the names of the two Java program files to be compared
2 s w% p4 e3 c' U7 p1 D) f; m For this assignment, it will be assumed that the two Java program files are in the same folder as your program.: |+ V8 `; B* K( v; q! q( z& c2 f0 [
** 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).
0 E5 Q9 M7 ]" A8 e' k3 O. |9 pBSA104 Business Programming – 2007: Assignment 2" M+ P4 ]1 L6 i/ D( h) s# r
Page 2 of 5
' l$ E9 {8 D& c$ w* {3 I& p4 mb) Print out to the screen all the lines of code that are the same4 t& t/ w2 d! W' _) ^
 Include the name of the file and the line number of the code being printed for each of the two files# m! f; q2 g+ D. E# [7 }4 J1 J
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
7 G* q: @9 l) {% A the name, username and department of the user. U; K1 ?+ b( A8 J& R$ E* r+ P6 p
 the statistics of the comparison
" l( w0 A r4 l1 r: B/ m9 U- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different0 H1 [! T) y$ [- \$ {
 the recommendation for further checking
3 o/ E. X7 c' O: T- 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: V" [$ S4 p# T2 N5 q
 the names of the two files compared
( }+ c4 @* b# Y# {d) Leave the program (exit)
# b9 E( ?1 }, Y& w- n- s' v+ CThe ProgramCompare class: (Total maximum 20 marks available)
: \- z+ @2 ] y2 h7 w2. 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) _3 b) O* A7 k+ p) C- \* V" \5 J4 N
a) provide an error message if the files are not found or there is a problem opening them5 J, `, `3 p; C9 M
b) compare each line of code. j8 g; U/ \6 ~- `# k2 `: j
c) print out the lines that are the same+ K2 n8 h, p: {
d) count the number of lines compared / lines the same
8 p+ `2 B6 U7 i. n0 A4 W0 e {The AuthorisedUsers class: (Total maximum 20 marks available). @3 A1 o0 q: P# u2 x! G1 K
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)
7 X: }5 X5 u( T5 O3 o% E n4. Provide methods to:
& w: `, S- o' T+ A2 ^! Ia) 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/ ]! o/ S, H2 Nb) return the name of the authorised user
, S' q& x* p( p0 P8 q9 M9 vc) return the name of the department of the authorised user
1 ]- \9 c/ B7 R' x& W" }Individual Data (Maximum 20 marks available)/ I2 W7 `; T& g1 ?1 |
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.2 W3 g! j2 o# \6 D4 U( `
Documentation (Maximum 10 marks available)( R$ p0 H4 ]2 w/ j- Q) H2 Z6 u0 Z: }
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.+ A% w8 \! A Q, j
BSA104 Business Programming – 2007: Assignment 26 ~& V+ U; g( k: v- p
Page 3 of 5 |
|