|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
! P) q$ W+ j/ h; V/ ZShanghai - 20076 P3 S: Q4 D# c0 [
Assignment 2
6 K( d' t1 {8 P' G. j6 pDeadline 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)$ @% r; l! z3 h5 @, u
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.
) R* U3 u- `1 D7 IThe staff must be able to:7 {& q' d) Z2 Y5 L
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
* ]' M5 V9 ~, H% p P' R4 N1 w1. 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.$ M# {3 S9 b. J5 U+ F9 U/ J! m
 The interface should provide a menu so that the staff can:5 Z/ f' S9 q t) n7 E5 ]" o3 j
a) Enter the names of the two Java program files to be compared
' }/ ~% | {1 g0 v5 ] For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
7 f+ v3 a: [0 t. b. Y( f** 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 r4 w4 g- Q4 N, {. c( GBSA104 Business Programming – 2007: Assignment 2! A- U1 T1 F, s" ]- _$ `
Page 2 of 5
5 ~& M4 j# y7 Rb) Print out to the screen all the lines of code that are the same
* Q% _# w8 c5 J2 r! L, S Include the name of the file and the line number of the code being printed for each of the two files! w) Z1 T, n& `9 \3 \7 j$ A
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared# y' e9 }1 ^5 C* G$ M
 the name, username and department of the user* J5 W( b5 C% c
 the statistics of the comparison9 H% C9 p0 w9 i& m* W3 f' l$ O: e
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
1 v1 C+ O# J% o C1 @ the recommendation for further checking
; I3 C: Q2 B% T5 f- 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& l. e1 l3 i" S
 the names of the two files compared
: P- I8 u( g- Y+ h$ D8 Vd) Leave the program (exit)
2 Z' ~1 `1 X+ Q, P/ A) f# xThe ProgramCompare class: (Total maximum 20 marks available)
- {" E0 l7 w3 L2. 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)
! X9 k! }/ d: Y- X* l L3 K( e# Na) provide an error message if the files are not found or there is a problem opening them3 c$ s% d- A" `6 A# H3 a, V9 A
b) compare each line of code
; O# B* [/ `. J4 H/ Ac) print out the lines that are the same4 y1 j9 ]8 k: P
d) count the number of lines compared / lines the same+ i6 ~3 k$ T# g4 J' n2 D
The AuthorisedUsers class: (Total maximum 20 marks available)
2 {6 _% t1 p/ Y3 n3. 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): n. H; ~9 Q: R! ?
4. Provide methods to:; e0 m$ g+ Z# b5 z2 y2 I4 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 match: s; v8 g l: s( H1 t$ ~
b) return the name of the authorised user
* E4 H3 f2 s( w, Rc) return the name of the department of the authorised user+ d' Y% W- A+ n" w. R7 y& U
Individual Data (Maximum 20 marks available)
( T6 x0 c) E2 R" R1 x0 ~# q1 v5. 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.
w1 y' [( j( D) V" N( D8 N" p+ _Documentation (Maximum 10 marks available)
2 N: {! e0 g: d }# q6. 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.
0 ^# C- k/ Y1 R% i8 q- x A/ Z# z% ]( \BSA104 Business Programming – 2007: Assignment 25 f' p- z# I- h' @ ]
Page 3 of 5 |
|