|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming, d' y" W2 s: S2 n( V7 c8 T
Shanghai - 2007) x/ f( O7 O2 }8 N6 w7 U
Assignment 2
" @4 j/ o( v3 L4 t& e0 C% D$ k8 gDeadline 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)+ c/ Q* s9 R) W0 L7 D: K z
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., {# ]* {; U' F0 F& i/ l+ O+ ]3 `
The staff must be able to:$ `$ J9 U0 ]5 j! c& y1 v# b$ @5 Z
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
9 W' A8 B7 V8 ]. F1. 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.
, N. T& z" v7 K8 i# C* H The interface should provide a menu so that the staff can:
! _0 B2 d( s. u: D0 ca) Enter the names of the two Java program files to be compared
; R& |) l& D+ @3 o" l2 w Z2 `( r- F For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
$ t3 b u* _9 u$ |' Y. 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).
' {( g9 o/ i" @) T" QBSA104 Business Programming – 2007: Assignment 22 u! I, s9 q+ x6 V( h
Page 2 of 54 s+ s' b; O+ n/ A$ F {
b) Print out to the screen all the lines of code that are the same0 k$ z g4 j4 e4 \! T ]
 Include the name of the file and the line number of the code being printed for each of the two files: P4 G7 k+ R6 Y4 {# q
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
- g8 w, r5 e. g1 d, c3 ` the name, username and department of the user2 P$ ?2 J: x( n% S2 t4 y% l$ B
 the statistics of the comparison
% R3 ?% u" a& M$ y- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
0 Y i" U% h( \4 I# w the recommendation for further checking
. g2 V' H0 J4 y0 N- 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) o! _; z. Z3 v. [
 the names of the two files compared
( Y c8 b, \/ U" `& m. {d) Leave the program (exit)4 v! \; |. n" z/ u! P7 k) ~; r
The ProgramCompare class: (Total maximum 20 marks available)# z3 v1 H( ]2 _( N) R5 p4 a
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)
e5 }/ Q' D3 d! o" F- j! j0 ba) provide an error message if the files are not found or there is a problem opening them, B1 g( {8 L8 F/ R6 S
b) compare each line of code
, Y+ ^$ G3 N, C! S; S$ c3 F6 gc) print out the lines that are the same! V% e9 I& ^/ G/ \4 a
d) count the number of lines compared / lines the same/ P6 B3 `% W( h% |3 H
The AuthorisedUsers class: (Total maximum 20 marks available): V9 j' U3 i9 o7 U* Y
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)
# g0 |& N* p6 ?+ U: y* c; {1 n4. Provide methods to:6 t! J9 x- l. m- g
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 match4 F4 C: `' m# i+ `( z0 Z% e
b) return the name of the authorised user
/ M3 H7 C/ O9 b' t U& R) u) Zc) return the name of the department of the authorised user, h+ x8 ]: [# W' Q
Individual Data (Maximum 20 marks available)
" r/ b% F1 D# F- ]' H# W0 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.' l' k- G: Q/ a, ?! Y5 b8 I
Documentation (Maximum 10 marks available)
: j0 E6 Y7 J! z& M$ v% _8 \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.& X9 ]4 S5 l2 }
BSA104 Business Programming – 2007: Assignment 26 j2 s0 o/ H) ?- a6 V. G
Page 3 of 5 |
|