|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
: q5 k9 ]; ]. d" _! cShanghai - 2007 m# H5 N' |: q+ F6 Y5 L
Assignment 2
* o7 K2 j' u5 A) q/ V8 K$ nDeadline 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)
# [0 b, Y& p! o1 ` j1. 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.! @( w6 ^- r0 h
The staff must be able to:
0 \5 g4 n9 ~' m$ e Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
& }* J) _. d1 r- G, E: M1. 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.
3 |4 _7 `2 W# u8 n The interface should provide a menu so that the staff can:! W* q2 i9 f$ W2 _5 }
a) Enter the names of the two Java program files to be compared
4 o# n4 H2 |0 h5 B r5 S0 C# D8 g. ? For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
: g9 H/ W7 F& e** 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).
) O# B+ k0 w3 M2 P" M4 n; `1 ?% g1 GBSA104 Business Programming – 2007: Assignment 2
, x i) w0 Z5 |% ^8 ~Page 2 of 5
6 s# u3 A6 F- e# d( F; g0 k6 ib) Print out to the screen all the lines of code that are the same6 d9 G% ?% y9 V) P8 R4 g {1 K# J
 Include the name of the file and the line number of the code being printed for each of the two files% v+ u' }, T3 ]6 e9 k3 I
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
- y5 A' J( x$ R0 z2 s4 F/ U the name, username and department of the user
* ]( I+ N2 B, M0 C! x! d the statistics of the comparison2 p# J1 k( `$ a" J Z$ u
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
$ Q* K! h. y) B1 Q5 t the recommendation for further checking
$ f& }# Y, ?1 W$ \- q( h. p# P- 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
& `$ d8 | Z' E5 u: Z0 D the names of the two files compared3 W: v5 D4 q3 {2 u/ s8 T, B9 c
d) Leave the program (exit)
! t7 Z. x' m6 k; a% {4 vThe ProgramCompare class: (Total maximum 20 marks available)
# M) r' @" N2 A: h9 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)
/ [1 K2 f x3 J% o5 B4 r+ y0 u) ga) provide an error message if the files are not found or there is a problem opening them
7 c i5 V3 ?1 f$ k" q' |b) compare each line of code
9 t2 `8 c: s3 u. `! ~0 x3 T5 Jc) print out the lines that are the same. o8 s& }' @: m9 o: v( V
d) count the number of lines compared / lines the same
& M H& L$ \ Y( l. b5 W4 {The AuthorisedUsers class: (Total maximum 20 marks available)0 {. ]+ d5 N; f. d' e
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)0 J, j) G; s$ D
4. Provide methods to:& n9 o+ g$ e6 u
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 match2 R/ E0 r6 I) [; ?, K
b) return the name of the authorised user5 X3 H' a/ _7 u$ S4 q8 L; E
c) return the name of the department of the authorised user) n8 }' U% \% }; ~# S
Individual Data (Maximum 20 marks available)$ P0 i0 N3 Y# F8 J9 A3 S; [
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.3 _$ w0 w# B( {- C- ~
Documentation (Maximum 10 marks available)
( @; }, ?/ Y/ n8 {, m# U. U6. 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.4 F* l0 g2 Z% H) }/ N3 a& r
BSA104 Business Programming – 2007: Assignment 2; F4 }4 C) U1 ?% T1 W& Y+ h
Page 3 of 5 |
|