|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
4 e; s1 W8 d% J; lShanghai - 2007
9 c4 [8 }* l/ _. M( N eAssignment 2
& M. [9 e8 Z! QDeadline 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)
n$ E; h5 s$ I$ p' x( \/ a! A1. 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.
9 I6 u! v- a. ?The staff must be able to:4 _" L# C6 H+ _0 j! x
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **./ W5 w; J, h' x: n
1. 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.. |4 m2 n* R: F
 The interface should provide a menu so that the staff can:
( l4 K' ^1 b7 }' C8 j' O6 sa) Enter the names of the two Java program files to be compared
0 D' t: i- m/ ~$ D, E. y- {1 y For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
7 c8 I% I' g$ ]2 N3 x( o) e- X% j/ }** 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# r: v0 H% jBSA104 Business Programming – 2007: Assignment 2+ Y( Z9 p* [5 r. b; Q1 s- x- N i
Page 2 of 5 M6 T& r6 w' x' I. _7 |0 e9 s
b) Print out to the screen all the lines of code that are the same
' [3 W, y7 [. Q4 ~# ?2 g" F1 ?% w Include the name of the file and the line number of the code being printed for each of the two files
& n% o! Y' h" F2 d9 ?+ N! K/ f. X7 Sc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared- p8 b1 Z7 j- d S: u8 U3 T3 {
 the name, username and department of the user! t1 `' Q1 O7 z! q- G. j
 the statistics of the comparison; e- C, C" }& q5 n
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
% O1 h) ]0 j+ F the recommendation for further checking
- l% X8 [$ T1 J- 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% z: Y' G8 `" ?
 the names of the two files compared
* Q* [/ ^5 o0 h# T( p3 g+ Rd) Leave the program (exit)6 R' F- Z1 L( e3 c1 Q! o. t ~$ C1 Y
The ProgramCompare class: (Total maximum 20 marks available)
( W8 ~6 o: }4 o Q ]5 ?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)
, E& E/ G( }" Y! Ca) provide an error message if the files are not found or there is a problem opening them
3 g- t+ W( E% D9 Kb) compare each line of code
( s5 z! h' P3 Z# k7 ?; f$ Sc) print out the lines that are the same, u# m" w( q0 u( Z) y7 P, j
d) count the number of lines compared / lines the same# \ A, `+ F+ U- l- D# }9 C
The AuthorisedUsers class: (Total maximum 20 marks available)
+ I X+ v7 I9 D/ u. Y3. 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)$ q, _6 x4 p4 A# P
4. Provide methods to:; D' q! c r7 K- 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
7 b( F$ \% |! a' J2 O4 i I% ?, z zb) return the name of the authorised user J2 v9 i; m! H& p E
c) return the name of the department of the authorised user
* r& w, g4 X8 }9 w- zIndividual Data (Maximum 20 marks available)
8 p4 {* M" G8 g; g: D5. 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.
& s% ]) q, s" _# @. ]1 I) bDocumentation (Maximum 10 marks available)/ Q* `8 i: V' V9 J2 m7 R( N
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.1 w4 d3 F0 Z/ V' S
BSA104 Business Programming – 2007: Assignment 2* m- q) x6 o U- d" Y
Page 3 of 5 |
|