|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
# R9 P5 A1 {8 z: I' tShanghai - 2007
" s/ |% ]) y3 DAssignment 2
' K9 U0 Y# I. m/ M9 z& A& r( FDeadline 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)
4 N6 v$ f3 ~' S. |; S# o+ y1. 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.
. \$ H! Z' T& ^) E% K, U/ e9 OThe staff must be able to:+ D1 a! Q& F4 H; @3 m# d
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.7 r; P; D% S2 x$ i& {
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.
3 C$ q+ Z7 B! k+ W The interface should provide a menu so that the staff can:6 ^& c+ ]* Q7 I6 J" Q
a) Enter the names of the two Java program files to be compared% g3 t2 U; m6 [1 c
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
/ r0 Q: [+ O6 t$ o** 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).
$ X: i$ J4 E* A0 G5 x h; rBSA104 Business Programming – 2007: Assignment 2! |. i% ]% v0 e0 f& q8 i" S9 v4 K& x
Page 2 of 51 f; [ I% V4 [: `9 m, q
b) Print out to the screen all the lines of code that are the same6 m7 h7 v' u" B0 g
 Include the name of the file and the line number of the code being printed for each of the two files
* W- o" N1 e" U7 `c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
& K# n$ r- ]/ I8 @ the name, username and department of the user% d. s8 o/ {& D/ W6 S9 }
 the statistics of the comparison
2 V9 B: g. t5 _, v' {1 x- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different3 D. r9 a8 g4 h7 B) D; y( ]2 D5 r2 C
 the recommendation for further checking* q. \' S; \9 y8 S, m: a; G/ w* M+ d
- 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 closely4 L5 w, m, K1 F' s
 the names of the two files compared
1 z: F7 m; K6 w2 ^d) Leave the program (exit)6 d( Y( @5 G5 D9 C1 a5 u
The ProgramCompare class: (Total maximum 20 marks available)0 x2 A3 F) ~4 q5 N2 U" V! |3 V' C+ R9 C
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)
" c+ S2 E/ J0 R; ma) provide an error message if the files are not found or there is a problem opening them
6 O4 Q! W) R; N \1 X) H' V$ j% Nb) compare each line of code9 _/ c/ G+ ?3 m/ \. n# I6 v
c) print out the lines that are the same
/ D1 j- B. L# ]- zd) count the number of lines compared / lines the same
; |9 ^; E6 e. c" L( c: _% H" ]The AuthorisedUsers class: (Total maximum 20 marks available)& D, `, H) C5 P6 S$ p
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)
: e5 d" H5 h4 K3 A3 ` M7 W1 \4. Provide methods to: ~4 _5 Y( ^3 z
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
3 n+ w' J; `- v; k: Jb) return the name of the authorised user* }' ~6 d7 y/ z. b: c& h" r% w7 O
c) return the name of the department of the authorised user& [9 c' F. f* [5 O& v7 q& m2 K
Individual Data (Maximum 20 marks available)9 N- o8 e5 F. }2 B# `
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.
6 |1 c l* f5 ~" _$ yDocumentation (Maximum 10 marks available)
, y4 [/ U" U, f6 h: j( E6. 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.- H2 |( n: F) n
BSA104 Business Programming – 2007: Assignment 20 s ]/ ?% i: N+ J$ o6 D
Page 3 of 5 |
|