|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming" @; I7 J6 k5 x! L [5 i x) x: M
Shanghai - 2007
9 F. N4 g& q! f; z- E1 QAssignment 2
# R# Y* P& P. J C* MDeadline 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)
$ M& k8 s0 k' h3 g. D& T1. 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 l+ @$ G2 e( D) Y8 MThe staff must be able to:3 f5 j3 N( Z3 d& [, L
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.; h# s7 h2 t( ]% k/ G I
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.- z5 N9 S1 _3 y) H
 The interface should provide a menu so that the staff can:* N6 {# h, Z: E4 ~# u# O
a) Enter the names of the two Java program files to be compared& G8 W+ u6 ]8 z$ G) o" a; |. W
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
4 S! ?8 t' `2 Q+ i0 {** 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).
, u2 O0 E. _- R% j i3 Y" }BSA104 Business Programming – 2007: Assignment 2" G* L, P0 W7 J* p
Page 2 of 5/ M |8 c/ S* G, Y! M# E$ l
b) Print out to the screen all the lines of code that are the same2 ~5 C" v2 F5 z2 ]! y
 Include the name of the file and the line number of the code being printed for each of the two files
2 c( c* G' V- c* ]! K' R% ~c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared! F0 H% k, V8 `" \% v6 Q& n3 s
 the name, username and department of the user7 a+ @1 _( K/ s+ x' m) q# d* ?2 @
 the statistics of the comparison
3 p5 A; w& e$ A4 r& m- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different6 P* s5 f7 p; e5 P2 x7 V8 \. u
 the recommendation for further checking% o6 L- M( u# [5 f/ m$ j! W. 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# w- X; |5 h2 v
 the names of the two files compared
7 m: e6 J; a/ a! ]+ R' C) hd) Leave the program (exit)
. `$ s& G) G* ?' \2 nThe ProgramCompare class: (Total maximum 20 marks available)) m: ]. O7 t7 _1 o) M" g! f3 P
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)
* G: L# [! P1 f3 B0 a! g, T% j$ z' aa) provide an error message if the files are not found or there is a problem opening them
Z }* f% P+ K* |b) compare each line of code* C3 A+ i% d. `: L, F
c) print out the lines that are the same
; ^' _+ J; x5 Td) count the number of lines compared / lines the same) Q$ R. T1 U* Z) [" d) M
The AuthorisedUsers class: (Total maximum 20 marks available)& E3 t* O8 I0 ` `0 \: S4 s
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 d2 R1 P" _1 G( t4. Provide methods to:3 }: y$ q2 P, E( L* x% _# [: C
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
0 U2 R( C+ O) |8 ]b) return the name of the authorised user3 W, p5 X. R7 R) F5 [
c) return the name of the department of the authorised user
. s: c* V4 d; pIndividual Data (Maximum 20 marks available)1 F2 @' I& h) j0 f9 I$ L2 d
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.
0 h( X% ]% h( l6 O. O5 B9 ?Documentation (Maximum 10 marks available)
( D7 p0 n B7 f; a6. 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.
Q5 E, c% U/ \; ?6 \0 G% dBSA104 Business Programming – 2007: Assignment 2
" K3 F# d6 ^; @ WPage 3 of 5 |
|