|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
, _# a8 @+ s* c, j$ S$ p* _, `( P/ K; MShanghai - 2007
1 q9 C& O0 D: @3 p& O% l; PAssignment 2
5 V. z& ]7 B( O9 EDeadline 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)
1 e+ J* ]" Y1 J# f% _! M1. 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.+ m1 t) k" U( U5 G
The staff must be able to:/ X3 G5 {0 `3 f. s
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
2 U; z9 N0 ?; y$ Y, P1. 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.; ]7 W: S) }5 o7 t, {1 L5 X
 The interface should provide a menu so that the staff can:0 e) d z, q6 p! g% R P0 U
a) Enter the names of the two Java program files to be compared. X/ M* @! E; Y# d6 Q& H
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
& C" Z$ s0 V# @** 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).% R6 I8 }4 u3 r1 s) |
BSA104 Business Programming – 2007: Assignment 20 K- ^- j% T4 _+ O$ H* k4 o
Page 2 of 5
+ K" j6 }( r5 g/ Z M4 u- Q( m3 yb) Print out to the screen all the lines of code that are the same. U! a3 v F" x9 R
 Include the name of the file and the line number of the code being printed for each of the two files5 o: f1 y& t* m; w' C! c0 C9 }2 \
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared8 Z( J6 M( i7 J0 Q( m5 m
 the name, username and department of the user8 `7 V% L" a, `- G/ Y; D
 the statistics of the comparison
2 |% S0 Z8 }+ p- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
1 G" P: n3 [& g& p4 \1 y the recommendation for further checking% G( J0 A9 Y2 t; k3 c H, T
- 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' M" [& g. X+ l; u
 the names of the two files compared5 |6 a/ _& Y# Z2 Y+ `" A" N
d) Leave the program (exit)
/ H- E: j6 a. X8 t7 }The ProgramCompare class: (Total maximum 20 marks available)
$ O* m3 V" O: @5 h' J8 Y2. 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); {4 H& Q4 y) D7 J3 ~' U
a) provide an error message if the files are not found or there is a problem opening them* `$ @, b% A, e2 e* W; H
b) compare each line of code
0 W* f2 u# j9 Z0 [c) print out the lines that are the same
* K/ k; D# ^4 {8 ?( Q1 Ld) count the number of lines compared / lines the same/ q8 ~ `. ~% O! I. _1 h' j
The AuthorisedUsers class: (Total maximum 20 marks available)& }. K9 s) ~1 N# i6 v1 G
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)
! ~" p: F" x" i% W& ]3 o4. Provide methods to:, @8 f9 u* P7 W
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/ z& O5 S. Y9 U
b) return the name of the authorised user5 @/ z4 }& v, R+ g
c) return the name of the department of the authorised user
# ]* q# h/ j) z; Z% l' L* bIndividual Data (Maximum 20 marks available)
9 ^$ g# T5 I* {7 k* J: `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 P: H* j/ @3 j' L
Documentation (Maximum 10 marks available)2 n3 ?. ~8 _$ Q
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.
7 J0 b/ g, g1 fBSA104 Business Programming – 2007: Assignment 2
2 g6 S- x$ r7 B3 t# NPage 3 of 5 |
|