|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming2 B8 _4 T) j( R x: c
Shanghai - 2007
. ^4 |+ u" W. T: \, d) W2 k: L5 oAssignment 2* i. l. [+ D* [, Q+ \" l
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)
. e* U2 F# N1 q0 V3 _2 \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.
$ S1 A. {* C) j- w6 r- B1 vThe staff must be able to:
5 L; P* m5 y( k2 g Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
, j" [, y$ v: D; y% }4 T4 e/ ~! r: ~9 D1. 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- D1 X* d5 Q2 `0 ^ The interface should provide a menu so that the staff can:$ l+ F4 ^. l% `% d- W
a) Enter the names of the two Java program files to be compared4 B! \# c, {& [: |3 @1 s; J
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
6 ~" `0 S5 {- _4 r" `. S, N** 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).
; [; C8 o k) F- `BSA104 Business Programming – 2007: Assignment 2, Y5 q" ?3 P9 \0 D Q- T/ f1 }' |8 O
Page 2 of 5$ ^% Z( N5 g7 w$ Y+ j( z
b) Print out to the screen all the lines of code that are the same
- [* F8 y- N9 I* X' t$ T1 T Include the name of the file and the line number of the code being printed for each of the two files2 V* o) R6 I* |
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared" F% v9 {- M# U
 the name, username and department of the user2 e+ q% ~3 q/ b" E. @
 the statistics of the comparison
- A- n' H1 E+ I4 z! J* U ^, d% K- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different: V% a1 u; A' i4 u
 the recommendation for further checking
7 U/ g0 V8 ?6 P5 |6 j- 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# t. N! B. @* V0 V" A the names of the two files compared1 [1 Q( N& p# b8 J3 y, _
d) Leave the program (exit)
" u- D1 ?% Y7 v0 O1 {$ |The ProgramCompare class: (Total maximum 20 marks available)8 M% k6 ?4 C! c/ ]: S* j
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)- v, r0 p. q# U) K
a) provide an error message if the files are not found or there is a problem opening them
" O; [* a& i! N4 f* B3 ob) compare each line of code
* O1 O$ _2 i4 C( s L Z$ O. X! Rc) print out the lines that are the same, W: V# o* ]+ q9 O( X, s- `
d) count the number of lines compared / lines the same5 }! S# O* N8 D5 N) B& G0 y8 Y
The AuthorisedUsers class: (Total maximum 20 marks available)3 B1 l& U( Y- X
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)
+ U% c t. b5 G1 ]8 U4. Provide methods to:2 \, @+ Z) h# j# X0 [% b+ U0 Y3 T7 J
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
+ P+ d$ a/ Z9 Y3 C* pb) return the name of the authorised user* P5 _7 ]( J* p8 C0 j! U, J8 [
c) return the name of the department of the authorised user
" e' P6 A5 @$ r1 e! ^1 P1 RIndividual Data (Maximum 20 marks available)
3 [( I" i: _, y* a1 B6 r1 b. X5. 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.
$ O2 V- G& p+ k. YDocumentation (Maximum 10 marks available)
3 p9 \: i8 u. @- x6. 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.# H% @( z) |9 d9 V) M2 M
BSA104 Business Programming – 2007: Assignment 2
. A! y8 c$ c1 _Page 3 of 5 |
|