|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
A2 m% G9 V/ e' T9 l8 k% x; BShanghai - 2007
# d9 w6 x1 Y0 Y! \Assignment 2
: K; e2 D! D, n5 }& 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)
8 Z' K+ ?9 x X8 A+ r3 f1. 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.
$ O% U- ?+ ^: ^* Q0 G6 i" aThe staff must be able to:/ p% k' |3 Y8 O% Q1 Z* L+ R' E
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
: N" O6 ~ U z1. 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.2 C8 H6 ~6 z6 ]1 R9 s) g( i1 i$ U
 The interface should provide a menu so that the staff can:
( N0 ]$ l) \3 q6 [) k4 j z2 Da) Enter the names of the two Java program files to be compared
! O* K( P4 U3 T) L$ ?, L For this assignment, it will be assumed that the two Java program files are in the same folder as your program.2 f' `' d. [. i S% s+ E6 w M
** 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).) s# a# H% N8 W: T8 O& L& {; L
BSA104 Business Programming – 2007: Assignment 2
6 }! i* w) o7 [Page 2 of 5
h# D# @+ t0 n+ `* V" j7 Z" sb) Print out to the screen all the lines of code that are the same* I0 a$ z3 r8 S4 u0 K
 Include the name of the file and the line number of the code being printed for each of the two files4 \$ J L' W& Q) _; m
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
( [# T; v* c6 n# m% D the name, username and department of the user
5 o T1 v% H5 \/ }9 R5 C7 @ the statistics of the comparison
. b2 P8 u+ j# R0 `3 v6 y- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
( e6 a- X- D* h4 c/ @ the recommendation for further checking
; |; e% m7 e: b( r- 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 closely2 ?' Q3 M7 E! }3 V
 the names of the two files compared. e9 m( X& r0 |0 u9 T
d) Leave the program (exit)) g% }: Q7 j% Q" k: N
The ProgramCompare class: (Total maximum 20 marks available)
! S5 y* I. |8 i* g3 ?% L, O. Y+ A2. 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)0 y% V: a. ~& B" X9 G; E
a) provide an error message if the files are not found or there is a problem opening them
- f0 E% l! z& [$ Q% Z- v( D0 A/ fb) compare each line of code! ~; u) H" A, K9 Z, f/ a
c) print out the lines that are the same; b! \3 o- d B0 K( o
d) count the number of lines compared / lines the same
! t6 L* @5 y( s! t$ ^The AuthorisedUsers class: (Total maximum 20 marks available)6 I! ~! Z/ Y; d1 _2 N% d
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)
5 w) Z/ E2 w. n, ~6 L0 r7 J4. Provide methods to:, x' G8 b8 R) z1 N S6 c. T: R" k
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
0 N+ m |& k% h& b8 P: yb) return the name of the authorised user
/ G, {$ m/ l' F6 }c) return the name of the department of the authorised user
7 e+ O/ J4 k/ p f d" T( j8 I7 JIndividual Data (Maximum 20 marks available)( i( c1 p% j, P6 p7 W2 a
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.
; l' y& e6 X5 ]' C1 qDocumentation (Maximum 10 marks available)
: t r- A, V* Z2 x6. 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.( o- l" ^4 }3 G2 A8 f9 z8 w
BSA104 Business Programming – 2007: Assignment 2: R" i/ c" `0 z. |$ R
Page 3 of 5 |
|