|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
. R. p6 G; I, y) sShanghai - 20074 {0 L. r5 Y7 A' _ C* l
Assignment 2
2 ]/ {+ c {. f1 I& s# ~9 e/ CDeadline 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)9 a4 k% P8 L- P$ h E3 e
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.1 {$ V* H. m& }$ o
The staff must be able to:$ Y0 Z0 y$ J5 ]0 U1 ]# o
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
; i# X/ @9 o/ O5 M/ p; N1. 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.
. l1 i; k6 W0 R The interface should provide a menu so that the staff can:
" _* h G: [% E/ pa) Enter the names of the two Java program files to be compared$ S9 O# @! v1 T. p2 `9 b
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program." G, g" o, x8 [& R% s: 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)., e; s+ k; V* F5 ]
BSA104 Business Programming – 2007: Assignment 2! `0 E. ^6 s- _% [$ r
Page 2 of 5
( C/ V5 e" T1 pb) Print out to the screen all the lines of code that are the same2 N; ~" b" B! r: h8 v' q
 Include the name of the file and the line number of the code being printed for each of the two files* Q/ |. j5 C4 |1 b, Q/ \9 E% t
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared0 ]0 D# b& H, K% V+ W4 R
 the name, username and department of the user+ `0 L2 O3 s7 m3 j$ ~# r6 h
 the statistics of the comparison# A% u/ K3 w& F! c6 b7 ]% R$ a
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
4 G* z% k% Z" S- Z, x the recommendation for further checking+ d/ D# Z) x E5 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
( k0 D; f' _' L; g1 d5 I the names of the two files compared
2 Y& Z: M, v' z# xd) Leave the program (exit), O2 a& `+ E3 Z
The ProgramCompare class: (Total maximum 20 marks available)9 V, `5 h5 f2 f, W
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)8 u7 H0 ]( g s7 X
a) provide an error message if the files are not found or there is a problem opening them4 d7 i6 i" W: J& |9 [
b) compare each line of code
2 |4 G9 R3 e. I$ lc) print out the lines that are the same& q& r: S+ P: V
d) count the number of lines compared / lines the same8 H2 d$ o2 }0 B. i8 g
The AuthorisedUsers class: (Total maximum 20 marks available)& r, Z) o5 m K: j7 ^4 K* t: f; @
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)+ f- C6 h) z7 J. f3 T( y
4. Provide methods to:
8 R1 f# w- U5 B5 d2 g2 U8 |( }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" B9 {& o4 |9 y; J
b) return the name of the authorised user
8 F! I# E! z5 H: }- hc) return the name of the department of the authorised user
$ ?2 {# I# r' A% d0 B9 }5 s, qIndividual Data (Maximum 20 marks available)3 B' Z4 V9 U, R+ r
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.
) v7 h5 l8 K& G5 e; ]$ G, H! h* QDocumentation (Maximum 10 marks available)# z5 ^% e" w/ u1 W
6. 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+ n! Y& s( o* G" h7 C% dBSA104 Business Programming – 2007: Assignment 2
8 a% {5 [/ X# Q' G2 [Page 3 of 5 |
|