|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
" _4 f9 @: t: E) u/ _ Q7 c+ b2 CShanghai - 2007, K2 c: _* H u' W) A' B% L$ q
Assignment 29 }. a( G# n+ A; p3 k6 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)
! w' C3 Z# K# C& e/ F" W1. 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 I& u$ e2 P( |# J7 d1 sThe staff must be able to:0 D3 g. Q3 G4 Y J9 y
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
7 I4 E6 A5 @4 H c) A1. 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.
& e1 h+ H+ R/ f- Y( y/ O, S) C The interface should provide a menu so that the staff can:
: G- S H3 n6 [5 J. M; I5 P- Qa) Enter the names of the two Java program files to be compared: e. f0 x8 Z" U- ^2 Q; w) l
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
7 X8 P$ R1 ]4 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).
- G2 m: ?' L/ ZBSA104 Business Programming – 2007: Assignment 2
3 s G( I* y' b5 l4 FPage 2 of 5; j& F, D) ~7 o! a" O& _, j
b) Print out to the screen all the lines of code that are the same' d4 n8 X2 c6 C0 @* p0 D1 @1 ?
 Include the name of the file and the line number of the code being printed for each of the two files
$ R5 ? ^, M1 nc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
- p) c; m; M- o/ i7 R the name, username and department of the user
2 d9 z1 |" X- o the statistics of the comparison- x0 o8 |: B5 N- V3 h0 x+ n( w6 s
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different% p, n& [8 N! A; e% x
 the recommendation for further checking
: b* ~1 F- r/ y- N8 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+ R% V5 Z; o: \
 the names of the two files compared( }0 X' V" J# ?+ q a8 G/ g
d) Leave the program (exit)
9 O/ u9 p2 N$ B! G, r! nThe ProgramCompare class: (Total maximum 20 marks available)1 Y4 e6 O k: u+ y: ^
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)& U! z3 ]8 d) X! F) _
a) provide an error message if the files are not found or there is a problem opening them
4 ~5 r' D: O4 v. D' Q: \7 Bb) compare each line of code
- @& g8 j( d) D: O- yc) print out the lines that are the same
' a; n3 K# A. j) \d) count the number of lines compared / lines the same
, z; S* g/ e% J. Q. `3 uThe AuthorisedUsers class: (Total maximum 20 marks available)* j3 v1 v9 X$ t! d) v3 B
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)
0 ~3 V. y. B4 T$ }4. Provide methods to:# R+ _* v% b- Y
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
1 v. P P2 W1 sb) return the name of the authorised user1 ]6 s1 m% A" R! q, p2 J
c) return the name of the department of the authorised user
3 _. B3 Y) Q+ n" ?Individual Data (Maximum 20 marks available)
2 [3 ]& Q2 P' }6 K4 }8 l3 H' o$ J5. 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.
, e) K. p! t! R9 a3 T0 ^; H8 d+ x' JDocumentation (Maximum 10 marks available), j8 |0 s/ n" v
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.
) d/ m) g5 x0 C0 e. R$ BBSA104 Business Programming – 2007: Assignment 2+ M+ s" w" M4 }" M" |0 A
Page 3 of 5 |
|