|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming2 p9 Z. r7 R8 Q, f
Shanghai - 20074 f& r" j1 \& ?, ^
Assignment 2# B* n! m. @, e0 K
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)
( C0 l( @3 Y5 ~) }, H. 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.
* A2 h* h; \" YThe staff must be able to:4 K$ T7 K" g) S
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.8 B4 M" @9 V8 E) U
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.$ D( G' w, e1 S6 i3 e
 The interface should provide a menu so that the staff can:& Y1 J! w3 f" V4 g6 S9 A# J. w
a) Enter the names of the two Java program files to be compared
! r9 g' P+ J6 s+ m _ For this assignment, it will be assumed that the two Java program files are in the same folder as your program.0 V0 a) n) e# ]. c
** 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).
; v, X5 } S! `( ~3 @; ~BSA104 Business Programming – 2007: Assignment 2
1 B5 i7 u5 A% @3 FPage 2 of 5
! B3 A9 f0 R! c, O. O+ ~b) Print out to the screen all the lines of code that are the same
9 ~( y( {8 e1 ?/ S* v' i# |% m Include the name of the file and the line number of the code being printed for each of the two files
6 M6 j o2 \, kc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared' f; J/ B Q; ?" n3 x; k
 the name, username and department of the user( [( y `) Y3 T! r- j4 d
 the statistics of the comparison- Q$ w4 V7 P$ t5 X& |
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different, i A2 j8 L) D) T8 l8 v9 p' e
 the recommendation for further checking5 X1 Q& J( C/ q+ E- r
- 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' k* P. Z$ y the names of the two files compared
1 w2 A2 G# O( Q+ M* V7 f) ^. e8 D( |d) Leave the program (exit)
, R; E9 x( L/ s/ B; B% V mThe ProgramCompare class: (Total maximum 20 marks available)
- M# Q' h- o5 I: }! x2. 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). `) Z B/ l0 f. W' A0 @
a) provide an error message if the files are not found or there is a problem opening them8 [$ ]) A$ j% h% {
b) compare each line of code Z$ e8 s/ ~5 _# r C
c) print out the lines that are the same
" l/ V; K! s/ ?9 ?$ n4 O$ V7 Q) R& id) count the number of lines compared / lines the same
) s. \& y" i4 R7 S" FThe AuthorisedUsers class: (Total maximum 20 marks available)/ ~1 L8 R6 e0 P5 H( R
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)( j# e7 v& v' j
4. Provide methods to:6 O) J( f$ C6 n- S
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
$ n. y6 J& {. k0 S! O$ i/ b0 Hb) return the name of the authorised user/ m" H x- x9 x! d. [& E. B* K
c) return the name of the department of the authorised user! B( e& C0 D' J$ l5 {! n) t( o" [
Individual Data (Maximum 20 marks available)/ e0 \$ ?7 U( y! 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.5 h' g0 J7 |3 ?/ I& m: M, t! n
Documentation (Maximum 10 marks available)& {3 C& X" Q7 u8 u( u8 s! j& Z
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.
. w* o7 V( j0 w7 CBSA104 Business Programming – 2007: Assignment 2
0 M0 X9 g9 p! A0 \Page 3 of 5 |
|