|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
$ l, j. o8 C. {! w1 r cShanghai - 2007% l8 C" P: E$ E
Assignment 2
+ t# q" k7 P& |; W4 k2 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)
# ]4 J0 c2 C, P3 H5 T; 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.
0 c. p* i( q }* wThe staff must be able to:
4 f/ Q, A) k' I/ o( k6 z Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
' c3 t+ A! Z9 g3 v4 T/ N; a. I1. 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.1 U$ O- H$ H8 p: E* y! P
 The interface should provide a menu so that the staff can:
1 X5 ^9 [( n- G5 h5 Xa) Enter the names of the two Java program files to be compared+ ~% h# y2 c! z- P: B7 B$ G5 O2 F
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program., b9 {: C2 s2 V: W' H7 L
** 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).
3 p) z1 T* \. N4 \: T/ G# l2 C" ]3 YBSA104 Business Programming – 2007: Assignment 28 \* z7 \4 z+ \3 u
Page 2 of 5
% w/ r; ~/ O5 c% S+ }8 ?: Wb) Print out to the screen all the lines of code that are the same9 F$ I" Q) V1 h5 X
 Include the name of the file and the line number of the code being printed for each of the two files3 [ T8 d6 R4 N$ [7 H M
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
3 Q! h) f) p# g/ {4 h the name, username and department of the user
) B9 L5 f# D; C( | the statistics of the comparison
5 D2 f0 X0 c; o2 x- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different7 Q' T: y0 ^( k' y% Y0 `/ P: P" ]1 |2 t
 the recommendation for further checking1 X0 y$ N0 l/ f0 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
% _8 Z) o m5 f/ j; N U' F the names of the two files compared B* ^0 [ ]% @' t) K
d) Leave the program (exit)
! S" s$ F/ |8 j N! yThe ProgramCompare class: (Total maximum 20 marks available)/ O& K; x6 h% V; E: R9 j" `6 }
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)
: g- r* i% G2 v) a$ Za) provide an error message if the files are not found or there is a problem opening them
& l# A& w @" ?, Mb) compare each line of code
0 ?% p5 u# B& rc) print out the lines that are the same4 l( d( J5 Z* c8 R8 F
d) count the number of lines compared / lines the same
$ l6 ?7 N* \' {+ c0 b" x* [The AuthorisedUsers class: (Total maximum 20 marks available). X; _. e' _1 D) [$ M
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)
6 j. k- u( h" B- X4 g; E4. Provide methods to:
/ `' u/ s& M! X6 a" P; Ca) 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
" Y0 {7 K4 P1 [0 T2 H. c2 tb) return the name of the authorised user
' I7 t& c9 P& Q8 lc) return the name of the department of the authorised user
D; d6 @8 z8 X- Y' \, Z! t0 XIndividual Data (Maximum 20 marks available)7 W: B' H6 r% W
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.
' @9 G8 ?) H X/ @- [Documentation (Maximum 10 marks available)
" z+ Q5 I; H* H% r6. 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.
( G+ u( S: ^- \3 f1 A' VBSA104 Business Programming – 2007: Assignment 20 o D0 _: q/ q |
Page 3 of 5 |
|