|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming O# Z9 y9 _+ c! E
Shanghai - 2007. _" V( |# `$ U2 G
Assignment 2* W6 x" ?- W' r3 z
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)
9 X9 k! ] V" R. s1. 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.% |2 U* b$ B3 _ M: P! V* c- B
The staff must be able to:
* x% ~/ t/ K& u9 g8 a- V; y2 u Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.1 l2 k5 O* m3 V
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./ S# E' ^$ V |+ Y* ]
 The interface should provide a menu so that the staff can:$ P! C: A# k- S" @* U& ?' f
a) Enter the names of the two Java program files to be compared
1 k1 `, O# X6 s; P! d% A) v For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
- G& H/ _3 K6 V( y: [** 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).
$ W3 Y' x% N" D, N3 }BSA104 Business Programming – 2007: Assignment 2
$ d4 C: g3 @7 YPage 2 of 56 a6 [6 Q! \, ^$ z' T3 x
b) Print out to the screen all the lines of code that are the same- ^; m3 W; k) a/ ?
 Include the name of the file and the line number of the code being printed for each of the two files1 O0 i! D9 Q+ M- x6 [/ s8 b/ b
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared" E2 ^' _+ g6 u |; Z$ {: J4 S7 ^
 the name, username and department of the user
& T$ J5 T5 B0 a: h r1 a the statistics of the comparison# H% E- L! K) V$ J! p
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different! i+ y0 H8 [- O9 s+ a( Y z; Q/ y8 A
 the recommendation for further checking
8 F/ o5 L) m9 O3 l! L. K- _8 b( 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
: s! ?: E1 |! K6 A the names of the two files compared* E, }6 x/ I& x' O( m
d) Leave the program (exit)
+ {; p. f% } S4 T) V# iThe ProgramCompare class: (Total maximum 20 marks available)% o( i& C7 d3 I6 w. p; T, 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)
# Z8 L; i7 E* P0 s" l& q0 va) provide an error message if the files are not found or there is a problem opening them- o' j% {9 ^' E, u/ z7 G) F
b) compare each line of code- j/ Q7 i" q8 W4 _: x
c) print out the lines that are the same" e! o1 H* z* [4 L8 k" F
d) count the number of lines compared / lines the same
$ |0 c" @9 e, u C" i2 t% A6 rThe AuthorisedUsers class: (Total maximum 20 marks available)
5 w: [, @. W9 `' }0 ^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 F& D$ \6 |- A5 P* ?4 X4 z4. Provide methods to:' d: [% Y& y$ j; l& m# s+ l
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 match7 { u" [ [, N2 q$ p' o, p# O4 P
b) return the name of the authorised user8 k, @0 O8 k+ P& _: N" _& }
c) return the name of the department of the authorised user
) @ J( X8 ^$ W: M" G6 P. E, kIndividual Data (Maximum 20 marks available)" K- `/ {" E) Y* t. Z
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.
( |4 [1 R( K: @6 FDocumentation (Maximum 10 marks available)) C5 ~" ]7 O& X$ v, c7 M
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+ R$ f9 |( c: M$ a0 b
BSA104 Business Programming – 2007: Assignment 2; [4 O' m# Q7 W" A* }2 q" I6 q
Page 3 of 5 |
|