|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
3 n! m' g& Q$ z6 Z1 \) q0 lShanghai - 2007
# P7 m& t9 p1 S' K. A) bAssignment 2
Q: t j! v: d3 l, m$ \8 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)8 G' T# }1 W; O+ i* ?
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.
4 p' |6 l: s, `# ~/ KThe staff must be able to:
+ {5 D: t+ N' y5 [. F5 @ Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.; L9 i: n$ X" T2 j1 \5 ^
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 v2 v$ g2 c) E/ A% G$ {( ] The interface should provide a menu so that the staff can:2 s; v l4 ?* p( ?. I7 y
a) Enter the names of the two Java program files to be compared$ K5 g2 ^1 |" N* v
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.7 B; s1 [: U( M: a
** 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).
4 X" T2 i. N( P- wBSA104 Business Programming – 2007: Assignment 2
6 Z# Y8 O) d5 B' | @Page 2 of 5
4 |, [: M0 V7 L. k7 \b) Print out to the screen all the lines of code that are the same
x- x0 u/ O7 |$ |- o# U Include the name of the file and the line number of the code being printed for each of the two files
# T& i3 X$ ^$ p @. ^+ i1 Y4 {+ _c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
2 f5 o) O+ z) x3 @% W. T the name, username and department of the user0 z$ W, o9 w8 L, \: U. t) C% o4 [) @
 the statistics of the comparison
* [4 u. @/ C% y( W/ ~+ e C: J- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
$ A6 m* J/ f( `% A6 V F the recommendation for further checking8 l9 @6 x$ e; K2 `0 j! u1 A6 _7 y
- 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, {1 ?* c( n; R0 j+ d$ j
 the names of the two files compared
2 N8 n8 d$ M2 Q% Y: l8 sd) Leave the program (exit)
D) |' U) ?4 v" KThe ProgramCompare class: (Total maximum 20 marks available)- _4 ~7 C" ?/ f1 U
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)
" R4 Y& u, I0 D# g8 N7 Ba) provide an error message if the files are not found or there is a problem opening them
# p/ `7 F( z" c$ c- n9 J# ^b) compare each line of code
5 Z5 T% w4 u9 Z* @' Mc) print out the lines that are the same! M e8 t1 U. a" A0 j
d) count the number of lines compared / lines the same& p7 y" x$ Z$ a; ]8 |
The AuthorisedUsers class: (Total maximum 20 marks available)
2 m. ~" i5 y! S4 S2 [2 c3. 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)
& Z3 X; s& Q9 ?; T! H6 a4. Provide methods to:
# W! I( v+ o* k1 n: |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 match
( }2 b: e5 n5 b# r9 T0 x" z9 }b) return the name of the authorised user
; t) C$ ~# Y9 D1 a" G9 @c) return the name of the department of the authorised user
; U: {6 V+ i: l" g/ \Individual Data (Maximum 20 marks available)
: z" G9 A; P" v* t3 e3 T% e z5. 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.; K ] f& {, b8 A+ f
Documentation (Maximum 10 marks available): w$ @% U. j n3 X! u, p8 X
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.
/ e) V* L6 w `BSA104 Business Programming – 2007: Assignment 2
6 I: z; b c( pPage 3 of 5 |
|