|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
: ?/ v* B7 N: P$ S x. aShanghai - 2007
. E: ?7 H& ^: I9 }- r$ X8 rAssignment 2
( R, l! I) g4 A% o5 mDeadline 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)$ Z; x) U3 I+ ^! F9 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./ K2 b& w; c$ n& s0 C0 S
The staff must be able to:/ A6 i/ e: s* H/ G& f
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
5 J* a9 g. n0 a+ A' k1. 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.6 B, m9 _1 n! ~+ M- i
 The interface should provide a menu so that the staff can:: Z" K4 [3 a9 l+ u3 Q, L( {
a) Enter the names of the two Java program files to be compared, f0 l5 C3 c) c6 A
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.6 }: x b2 p* I6 R* G6 N& v! Z
** 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).8 w% v5 L- K! n8 C
BSA104 Business Programming – 2007: Assignment 2! B1 ]- F6 o; d* S, [0 P
Page 2 of 5
7 n$ k& x7 X: [+ Z" Y* A/ O: Nb) Print out to the screen all the lines of code that are the same
8 `# S" y! I5 [4 k Include the name of the file and the line number of the code being printed for each of the two files
, C3 E% J |! x; M- G1 Rc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared) s: h3 L W, |- Z! K0 X9 z1 ]. x; S
 the name, username and department of the user2 i8 m5 @9 V! M8 T- l! k$ W
 the statistics of the comparison
6 G6 h6 g" t2 q6 R K2 K- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different0 L" S% A# c- Q6 g- j+ e; C7 z! g9 C
 the recommendation for further checking
6 o% c& P: v1 |+ ~8 n- ]- 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 closely3 u% K+ k/ C3 n6 {/ Y$ K' j& B
 the names of the two files compared
+ Y' ^# \) V: _% _2 Z3 J, t- n' Kd) Leave the program (exit)
8 W8 Q/ C3 \: A" t; c: X$ X7 m' W2 r+ SThe ProgramCompare class: (Total maximum 20 marks available)
- z6 q$ _ G4 `9 |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( `* u: @' @5 J" D
a) provide an error message if the files are not found or there is a problem opening them
1 ?1 J+ I" {; d* F7 gb) compare each line of code7 S Q5 c* A5 j/ b/ I4 V6 @# F! Q- {
c) print out the lines that are the same5 x! z3 e% U" \1 N$ S
d) count the number of lines compared / lines the same
l$ C; A7 ]: I4 d8 G9 HThe AuthorisedUsers class: (Total maximum 20 marks available)
3 j/ C2 ` ~9 w6 J/ x0 z& q% V" L O3. 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)
! K& m! ]5 G6 |/ @4 D/ T1 Q7 a3 r4. Provide methods to:; B: w) I2 O4 K) g% j# J
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
0 H9 p) x2 b: X j. c0 ob) return the name of the authorised user, I7 h: F# c4 H I6 l1 Q- q
c) return the name of the department of the authorised user
# p2 N' c* W/ F5 b' cIndividual Data (Maximum 20 marks available)" l6 z* Q2 G0 k
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.+ ?/ N2 L4 G; x' |3 F$ q
Documentation (Maximum 10 marks available)
* h+ o7 o9 r' c# j+ l0 g6. 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.% q7 I. }6 F/ r& n! F
BSA104 Business Programming – 2007: Assignment 2
! C3 v: U9 I, \( h: S; e; KPage 3 of 5 |
|