|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming$ [, S8 j F' c
Shanghai - 2007$ p* e1 T+ u& G5 s8 ?/ r( Z5 U
Assignment 2
W6 M/ {# c! [( P* ^: XDeadline 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)
# t' [6 N6 I3 I- p* \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.
9 x0 A2 v8 R! u E! H% ], O1 GThe staff must be able to:( `6 n# Y' r" ~7 [+ e
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
" c2 q& p8 Z$ t+ N. T4 Z' e7 {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.$ A7 }: r4 {" [& P- M, A* P) u; [
 The interface should provide a menu so that the staff can:2 S% r* h* s% W( q2 H8 a. C
a) Enter the names of the two Java program files to be compared
4 C( G/ r3 F% G4 i$ O" a For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
4 p7 Y; ]- S) I- \$ B: A. m** 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).
- r: l+ q, A3 t+ XBSA104 Business Programming – 2007: Assignment 2, h% n: X ~% G# S
Page 2 of 5
" P \' `! P1 G0 m$ k' lb) Print out to the screen all the lines of code that are the same1 F$ @+ a" i4 y" Z* J% L9 N& y
 Include the name of the file and the line number of the code being printed for each of the two files. Z$ E o/ n0 U7 C) P& X6 ]' F
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared8 [. Q, v9 e ]. P9 ?
 the name, username and department of the user
1 ?+ N: P- x u5 Z0 S+ p/ x the statistics of the comparison: L' `9 t" U y) f& U
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different" G+ Z1 M: ]1 x) L: f2 `
 the recommendation for further checking
8 v( M0 D/ O6 V8 T. n, P8 d' s- 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( ~5 y6 Z& T! l4 `; V
 the names of the two files compared
0 k" k8 Z0 _9 s; u k. Kd) Leave the program (exit)
! m' c$ e9 A5 D; M' DThe ProgramCompare class: (Total maximum 20 marks available)
( ^' v2 W F( c, x+ x+ r2. 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)
* m% h7 ?2 n- va) provide an error message if the files are not found or there is a problem opening them
A. G" s# e. k. `5 j, e- a- {b) compare each line of code
( B% B5 a8 J+ C+ I" Z8 yc) print out the lines that are the same
8 \2 W* M9 s9 o i1 { @d) count the number of lines compared / lines the same" s: W% w8 q. d$ t3 K0 O7 G1 O
The AuthorisedUsers class: (Total maximum 20 marks available)
5 `' P5 F v$ C5 j. d- M3. 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)
9 ^9 k# J' G( C7 l- k4. Provide methods to:; V; d% L& K d, o0 N; X
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 ^6 n( h& v6 }) p5 qb) return the name of the authorised user, _$ h7 i& _8 j! g3 j- R
c) return the name of the department of the authorised user3 R; v6 j" m# G' T( b# f7 Y6 k; S
Individual Data (Maximum 20 marks available)
7 c. a! z- M2 q# T% d5 S5 @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.
8 `3 E6 ?) H+ q4 L: Y6 f- NDocumentation (Maximum 10 marks available)
) d% X' g, O1 b6. 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.
2 C( W) p/ K7 l2 j; @BSA104 Business Programming – 2007: Assignment 23 v1 p8 s3 x: d
Page 3 of 5 |
|