|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming. w/ v) N. i9 {4 w1 B' n
Shanghai - 2007% B. ~: H0 o+ S9 J
Assignment 2- X2 ^ u! }8 Q
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)
$ Z* E. ]3 h4 r* e1 d' c& j1. 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.
: P0 N* v/ r2 I3 O3 u; L- d, BThe staff must be able to:
( l* G0 a5 g, @& z* q Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
* V: `; s: H3 z, Z$ S% g1. 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.3 [' D; V/ f0 i- n, u; b6 O
 The interface should provide a menu so that the staff can:* w1 o5 {$ M; M# b" V7 X! j
a) Enter the names of the two Java program files to be compared
0 }, H' @1 l3 r& K5 N$ D For this assignment, it will be assumed that the two Java program files are in the same folder as your program.4 f- V* U( J/ b3 Q* e0 d/ G8 V0 ?
** 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).: m( ~' n: q0 y2 J; J7 v
BSA104 Business Programming – 2007: Assignment 2! {# a8 ]4 m) g. W& p+ `2 d) u
Page 2 of 5
" z H8 f3 H. S' M! K( wb) Print out to the screen all the lines of code that are the same
7 e- m$ K: j5 [; O& e+ d Include the name of the file and the line number of the code being printed for each of the two files1 O$ a1 W& |2 a
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
" p. ^; h7 D7 M2 I3 U% a1 Q the name, username and department of the user2 t: G& d- ^) S! c9 ], r% _- p+ Y
 the statistics of the comparison/ E0 g6 l8 U8 E2 p' A
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different8 z1 h2 N4 V. g
 the recommendation for further checking% C0 i5 p2 _, m5 C l, x Q
- 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 D! D7 U& g# K# R
 the names of the two files compared% |8 z" Z9 b |& o1 V- D9 @8 p
d) Leave the program (exit)8 \: N: {# c" G F+ I; V' U v! V
The ProgramCompare class: (Total maximum 20 marks available)
* F) \+ c- x. s: o% J$ ^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)9 Q5 \- k: t6 b) L$ Y% x7 j
a) provide an error message if the files are not found or there is a problem opening them
4 Q+ S4 w# k; k0 {* F* pb) compare each line of code
0 \" r1 d! E; I& `c) print out the lines that are the same
4 |7 ]* ?4 g, C$ T5 [d) count the number of lines compared / lines the same9 ~3 S( b% e5 g. ~4 p
The AuthorisedUsers class: (Total maximum 20 marks available)
+ T9 B( C. F2 ^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) Q) F8 M, r- E, d0 T8 ]
4. Provide methods to:
1 x) r4 V$ ?' g' M8 j6 ra) 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' Z& O: }- w+ ~5 e
b) return the name of the authorised user
- n" P# k5 a8 d& K. Ec) return the name of the department of the authorised user
0 }* K0 R% L, m9 l! h" P( bIndividual Data (Maximum 20 marks available)
* Y5 E" w5 v! c4 H) S3 P9 g2 n5. 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.
: V8 e" M! f# W/ {1 T7 A: |+ P1 |Documentation (Maximum 10 marks available)
3 R/ o% J1 r; y, p& L! o6. 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 w5 a- ^$ y' s9 j5 h& w7 i
BSA104 Business Programming – 2007: Assignment 2
; B$ O2 T/ k# Z8 y2 |Page 3 of 5 |
|