|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
2 \; p0 t4 S6 v! ^9 P5 s( nShanghai - 2007
" f* C: B4 r* |+ l7 C4 wAssignment 27 {1 A" Y! A. |( D
Deadline 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)/ y2 k+ c( d8 J% o4 l+ i
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.0 b7 a: V; ]9 Z6 s% W9 _9 x5 h d9 _
The staff must be able to:0 Q# u% J+ ^: W2 Q5 [$ m+ `& m
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
: [7 U7 o0 J# N7 q% ~% Y1. 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.
1 F. f6 l, x0 u9 y O& L/ F+ @ The interface should provide a menu so that the staff can:) s6 j* Q5 L6 C1 ~
a) Enter the names of the two Java program files to be compared
2 k% ^9 j3 E& v( b! f4 w. T- z' l( @5 ^ For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
0 n" t* }) k. P** 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).
- H O- h h" I/ f' e2 q8 IBSA104 Business Programming – 2007: Assignment 2
0 p C. w8 Q! b' OPage 2 of 5. G% a, C; ^8 T$ I# @+ m+ y8 Y9 b: [
b) Print out to the screen all the lines of code that are the same
( S7 G7 U/ S4 T$ F Include the name of the file and the line number of the code being printed for each of the two files
7 F! i: x/ Y# |( w& [# ?; {( G1 ~# uc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared6 ]0 U8 B& [, B+ a' X8 G$ x; k/ V
 the name, username and department of the user7 |. D" i; k. m. k
 the statistics of the comparison" I" k3 m3 [2 c# y5 F# S
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different1 A) W! E+ v! Q- `* A4 F+ A
 the recommendation for further checking( a; h! `1 z, W, F4 c) x# Y* 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
# R, s6 C O M: m the names of the two files compared' p4 i7 F+ ^8 b, R& Q4 P* l
d) Leave the program (exit)
# D1 T) b7 {8 t A4 o% xThe ProgramCompare class: (Total maximum 20 marks available)2 V. v5 K3 D$ q; F/ Z+ m2 a/ F
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)
, k0 F& q. s! t# }4 ga) provide an error message if the files are not found or there is a problem opening them
1 b% d9 V9 I2 s5 \4 \) I" G6 Pb) compare each line of code5 e0 i. I8 D( L2 _% I" C! o
c) print out the lines that are the same1 {* U/ p9 w r9 j. S/ E
d) count the number of lines compared / lines the same( k0 Z2 @3 G+ B; M, U* A; K
The AuthorisedUsers class: (Total maximum 20 marks available)
* L" s7 |1 A2 M8 V) \8 f9 q3. 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)
( T! B$ a2 y5 z1 K I4. Provide methods to:& V8 y! r% E$ s4 O" s) u, j
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- ]# a; f% }- _3 Z4 t
b) return the name of the authorised user
, Y) m8 c9 ?' bc) return the name of the department of the authorised user. g6 n4 M7 O; D4 u. w P
Individual Data (Maximum 20 marks available)
; Z( Y/ w0 `5 p% b' Y5. 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. g% e& Y% c) ^7 R1 ~
Documentation (Maximum 10 marks available) m( J( }/ o+ U3 @ E8 H
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./ {9 D& q1 n( X _
BSA104 Business Programming – 2007: Assignment 2& i& V% `7 V3 Y2 V: [* n7 ?$ Y/ H; U/ g
Page 3 of 5 |
|