|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming* M* s5 ^) w7 S+ x' p+ t
Shanghai - 20077 G1 F1 M- b/ n8 L% j
Assignment 2
- d! Y- }/ h% Z+ I* t% ]' Q$ S ODeadline 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)
1 Q- u+ u1 {% t, l9 L1. 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.
( v5 H* L8 ], Q% a% `* z8 sThe staff must be able to:
' U5 D& V- I) }! f" W& b' u' _. ^" K: D Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.
0 D& v4 x# i: y+ E3 J/ Z$ F5 i1. 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.: D& i4 t+ e9 _0 f. _
 The interface should provide a menu so that the staff can:: u- n/ F8 O- E! G( r
a) Enter the names of the two Java program files to be compared
$ z$ O. ]! N6 P4 ]# O+ T For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
' ], z# s. p4 |** 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).# Z0 T/ B! b- v/ z4 J" {
BSA104 Business Programming – 2007: Assignment 2
! K0 W7 L: ~6 D+ m% mPage 2 of 59 R/ E4 F) @; E3 t# G6 d0 c4 @0 n
b) Print out to the screen all the lines of code that are the same
9 m% t! ?; [$ Y/ e6 ^9 v Include the name of the file and the line number of the code being printed for each of the two files+ g/ U# E9 b& W+ I: u' N; M4 C
c) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared' g3 b5 K2 j6 ?" p. k1 q$ ?
 the name, username and department of the user/ V% J( N3 i, V7 n$ A7 X
 the statistics of the comparison V& A D# ~7 d2 d, g
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different
! z9 N! z+ x) s4 G p8 q v the recommendation for further checking
+ w. [5 i: A& H$ z6 B( i- 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 z6 q! ]) h# }2 p the names of the two files compared
6 i( T+ \5 |- x# md) Leave the program (exit)3 Y9 X8 O+ u9 r. V6 |, Q' s1 s& R
The ProgramCompare class: (Total maximum 20 marks available)7 c( ~. r3 i S* m5 }
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)- w! G/ p! s8 b) \1 T* V; U7 b
a) provide an error message if the files are not found or there is a problem opening them* l" d. C! J# H+ [/ p- ~
b) compare each line of code# h/ L; C! ^- q* d; R# v U8 K& Q
c) print out the lines that are the same! i6 p0 S/ q# T" k
d) count the number of lines compared / lines the same) T, E0 @4 s4 F- T
The AuthorisedUsers class: (Total maximum 20 marks available)9 `5 q* _- ]9 Q& I
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)
4 w9 g/ W2 A+ e. n. E% Z4. Provide methods to:) B! u T) [& Q3 C
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 match6 Z: @; g1 H$ G$ h- }$ t
b) return the name of the authorised user
2 a' R: Z. N$ L5 \* h M4 V+ Mc) return the name of the department of the authorised user
* u) t( q5 o1 h( LIndividual Data (Maximum 20 marks available), L2 ~, T! A8 Z; l0 p; S
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.
6 ~6 t6 n7 K$ k% ]Documentation (Maximum 10 marks available)
5 B2 f5 G4 g$ ?' }7 ?$ J2 w6. 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.0 d/ J4 w! y) Q3 k4 Y
BSA104 Business Programming – 2007: Assignment 2
+ F1 t4 B# [0 ?9 YPage 3 of 5 |
|