|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
; A1 h- {7 m8 w* W- P. `Shanghai - 2007' E* [* Z& e, C% s/ p
Assignment 2
' J! ]* M% r% Y- sDeadline 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) m1 n8 X; l `& L- n* n
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. \; d C+ ?! b2 S
The staff must be able to:
& p* n9 m, Y1 O2 N& ^ Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
0 D" B: C9 ?2 X1. 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.
2 U$ S ^ C; Y3 R The interface should provide a menu so that the staff can:
$ w& _9 l) }2 F. k8 W8 l0 H2 E7 Z) ga) Enter the names of the two Java program files to be compared
# O5 x! @! W0 t$ [$ t7 [# } For this assignment, it will be assumed that the two Java program files are in the same folder as your program.5 Y& ]# ] T# Q3 }3 T# a
** 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) ^3 l6 [& r) a
BSA104 Business Programming – 2007: Assignment 2
# x: u$ p. Q4 |' yPage 2 of 5! n0 N- k/ P+ w1 l# l
b) Print out to the screen all the lines of code that are the same
( ?+ a6 A+ @6 q5 q- f Include the name of the file and the line number of the code being printed for each of the two files# K; o, c8 F( d" w
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared+ x! `9 D- q9 Z+ R) H8 B4 ~
 the name, username and department of the user' T( J; d7 f; B
 the statistics of the comparison
+ L" E3 A: T3 d4 A$ T; ?. A- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different4 l. R- G& W, K( Q, M
 the recommendation for further checking
" \1 P) [, H" |- N M# Q- 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
* y7 w6 ?! ?' p K6 {, K the names of the two files compared
5 @0 Z2 u5 O( o: E, z9 |) s; od) Leave the program (exit)" v2 K- ]* U8 n* e/ B
The ProgramCompare class: (Total maximum 20 marks available)1 `' `$ ~- P l4 E8 h
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), {, y5 a6 S1 l) M- A7 N2 V- ^' J: o3 R. J
a) provide an error message if the files are not found or there is a problem opening them
0 X0 x7 H$ W9 kb) compare each line of code
( A% ^$ [5 A# ~8 T5 A- Lc) print out the lines that are the same" R! Y: t [* S
d) count the number of lines compared / lines the same
+ q" i' ?3 }5 l5 LThe AuthorisedUsers class: (Total maximum 20 marks available)8 a2 w! q0 ~1 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)2 k+ {0 H2 d. e: j, e8 [
4. Provide methods to:) k0 H& E) B4 F9 j6 E
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 match7 j$ |; D9 A2 m7 k: B2 K
b) return the name of the authorised user
; M9 V$ j, X' W" A2 ~) Y3 q8 v; {c) return the name of the department of the authorised user( o5 {( M: b o$ N: L& H8 i
Individual Data (Maximum 20 marks available)( H& \: ]# ~5 V7 Z: F7 W: V
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.. A% h% g7 V o4 ~
Documentation (Maximum 10 marks available)
6 A9 ?8 u/ r |; e% D" E1 T6. 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.
: N7 U* U. l- l @% q4 _+ F$ |BSA104 Business Programming – 2007: Assignment 2
% G+ ~# |" k/ K: kPage 3 of 5 |
|