|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
# |' o& n- ]$ U9 P. N- `6 O+ ^Shanghai - 2007% x/ ~0 C. q4 C0 F
Assignment 2
' l5 n6 a: Z3 n! A! {Deadline 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 T2 \' y% @3 m# H, C' k+ i+ U1. 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.. e* V+ `5 T4 }# v/ j, c
The staff must be able to: t, Z0 x1 o( n. y) H0 S( E H
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
( s9 o: f6 S8 c% J/ {4 D2 A; E1. 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.+ e) D* W" j; Z; D
 The interface should provide a menu so that the staff can:) P$ x% s. S/ K# w- b
a) Enter the names of the two Java program files to be compared
, ]8 G3 [( Y9 s! y% k1 h$ ` For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
6 z. k6 K8 y+ 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).
8 A+ m: q, l. F: w0 j& E7 HBSA104 Business Programming – 2007: Assignment 2
) d3 a& J! r p6 z/ e2 U# e3 IPage 2 of 51 Z O8 d, z3 l
b) Print out to the screen all the lines of code that are the same8 _" E, n1 H& G+ C0 G& P: U! y
 Include the name of the file and the line number of the code being printed for each of the two files5 A& A2 C' X) H, ?; A
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared; L# w" d/ W# W# {4 M; B
 the name, username and department of the user
$ N# j2 P u- p5 Y, \6 w the statistics of the comparison3 O2 W* @+ g z2 X
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different9 e6 B5 l; S3 c9 N+ c: b
 the recommendation for further checking$ x% j; {7 d" b( y4 `8 {% a" v
- 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 closely9 L4 ~$ R" F6 ~+ X: t& c) v" Y
 the names of the two files compared
; N- X0 }1 o; b5 Nd) Leave the program (exit)
8 n6 A R* e2 l6 v* ~The ProgramCompare class: (Total maximum 20 marks available)
3 K3 q+ D. e2 ~! C- b& T5 o2. 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)
. n, j$ Q' X8 M# F$ ^$ t$ Oa) provide an error message if the files are not found or there is a problem opening them; R% k# |2 O8 }: E. A/ y# Z; y" D
b) compare each line of code
) i3 ]% B2 W4 H y+ cc) print out the lines that are the same" v Z1 w5 z1 b
d) count the number of lines compared / lines the same
, B7 n$ |7 c9 b: qThe AuthorisedUsers class: (Total maximum 20 marks available)
5 P. B3 f2 f8 F7 C" ?; L; B! ?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)
& Z9 R2 U& q% H1 z! \ c; _6 z( l/ B4. Provide methods to:# N, n" Q$ r1 |" Q! C
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
! j& L$ l& s" u; G6 s {% @b) return the name of the authorised user
' G% R7 v6 @2 m3 Ec) return the name of the department of the authorised user
" g9 p. C: [5 YIndividual Data (Maximum 20 marks available)( N4 f4 J0 @4 p
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., C7 q# a+ a7 d4 U+ s4 J+ p
Documentation (Maximum 10 marks available)
; Q4 b0 Z/ }$ r2 f6. 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.' }- z, A# h1 ]* I0 L
BSA104 Business Programming – 2007: Assignment 2
/ O% }9 p0 {; u- E* K# F1 `' d$ XPage 3 of 5 |
|