|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming1 c. p/ R; u; u6 B; u* `5 A# o
Shanghai - 2007: G6 u6 ^9 d8 f7 A7 |+ O: ]
Assignment 2
i* T3 G7 \: n$ lDeadline 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)! i e* h8 F& M) B- H) a4 u
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.) m# P$ z; u$ _6 _3 J; M
The staff must be able to:# Y% R0 X& P+ ^4 v6 \% K
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
& t, Z9 ]% x# z1. 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.* b( S6 E3 M$ [* n
 The interface should provide a menu so that the staff can:& G7 J, o8 T; `5 X a
a) Enter the names of the two Java program files to be compared Y9 M) A- W$ s! ^6 s
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
6 ^, z& j2 | r$ J8 }+ g) Z/ 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).
9 H' u( K% o! D1 W9 ?$ UBSA104 Business Programming – 2007: Assignment 20 P/ Y8 H( q1 s0 H! e
Page 2 of 5
' }. b) ]" Z3 K& z Xb) Print out to the screen all the lines of code that are the same. i+ a5 O, O. A6 j5 z9 h! j! y @
 Include the name of the file and the line number of the code being printed for each of the two files B+ S* w! g( s& P* P, [
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared1 Y6 c2 G5 s, M' f$ [
 the name, username and department of the user
0 C+ `0 w2 R2 @/ u4 q" k9 P. q the statistics of the comparison
, h+ ^- t1 q# y) K- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different! s3 X# `) G& q( l
 the recommendation for further checking
- H9 U: B8 n% t. 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( n. o, \ a6 L4 U: t
 the names of the two files compared
; s* F+ v/ Z8 Q7 G+ Wd) Leave the program (exit)
5 b; s4 E6 p+ WThe ProgramCompare class: (Total maximum 20 marks available); j5 t5 _( T, t/ W- |
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)) _; e, K; N% O& M/ [7 h7 \' O, `) ~
a) provide an error message if the files are not found or there is a problem opening them
. X7 s2 f. ]2 }* ~ z+ ^$ ~b) compare each line of code3 `$ i7 \$ ^5 {9 D; M9 X: x6 y
c) print out the lines that are the same' u7 D& b5 Z5 r* T1 w
d) count the number of lines compared / lines the same
@4 [2 j: |0 L( t( jThe AuthorisedUsers class: (Total maximum 20 marks available)
; b* ]3 P& q6 [- d3. 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)
; s6 H# T% Q( s) ]+ {& z. t' A- w4. Provide methods to:' F2 O8 v6 T- ?% H2 B1 M" h8 G4 k
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
6 I! `, L5 z9 G4 f! ]9 fb) return the name of the authorised user3 Y: y' F1 J5 C4 g+ t
c) return the name of the department of the authorised user
5 M0 L5 K# z9 {+ S" x f# yIndividual Data (Maximum 20 marks available)
. T R* o5 D1 |' L5. 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.
3 @/ z- W1 O6 {" a0 s" ~* aDocumentation (Maximum 10 marks available)" n$ s) R5 b) N9 C, l9 m" x7 T) M0 h
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.
f$ [+ b% U$ B: H( h* U* zBSA104 Business Programming – 2007: Assignment 2; r, U& r5 q1 |# h$ ]" S" U
Page 3 of 5 |
|