|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming) M0 X8 v* o9 S4 E9 X: R i0 R
Shanghai - 2007
! U+ ~% `, Y! B5 F+ x fAssignment 2
/ x' R( V1 [: J; [, L5 dDeadline 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)
! ]6 O; m# { ^" l- D& @4 ]* o1. 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./ m& z2 s! S+ V! \
The staff must be able to: N5 [) d0 g! @! j
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.. ^0 y F2 T" r$ ~+ \. P
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.
) b; I9 p! {# `, P/ } The interface should provide a menu so that the staff can:
! y0 |' B* v, a" l5 ]a) Enter the names of the two Java program files to be compared3 ?9 J$ Y& @* J/ E1 } ~
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program., O5 f7 C5 Z: Q0 A$ }* D
** 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).# a2 S# O4 s0 _2 y( I" d9 m8 ~# R# \
BSA104 Business Programming – 2007: Assignment 28 [* y/ r/ `- z! B; ?! d
Page 2 of 5
- I! |6 J( X" Q qb) Print out to the screen all the lines of code that are the same) ?" L e ?! m
 Include the name of the file and the line number of the code being printed for each of the two files
; e. U' Z2 [4 J3 dc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared, s: U3 q+ S1 v4 x' ~7 `
 the name, username and department of the user
9 C- K/ h- |! J the statistics of the comparison% ^: m" R4 e4 S6 r: ~4 Y& J
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different7 U" ]# k% v" t& E7 B# q
 the recommendation for further checking
' w) p( N/ n9 @( ^( J0 }- 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
/ b' Q/ X0 {7 d* z" W; b- S the names of the two files compared
1 {% W4 N: W! W% P" T2 I- p3 Hd) Leave the program (exit)5 b1 `/ p8 t; V5 `! ?; a! Z
The ProgramCompare class: (Total maximum 20 marks available)/ J( ^+ y. G f6 w4 @2 C
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)
& S; `6 o! C3 N) c, H- ]- \$ ]a) provide an error message if the files are not found or there is a problem opening them2 X2 m" M; q7 R$ n, S4 B. X; Y
b) compare each line of code
9 I1 r4 i/ X( @ a. s) Y0 @c) print out the lines that are the same
) `6 S( g6 Y% b& O+ X4 zd) count the number of lines compared / lines the same/ R: }4 o' v+ u0 ?# M2 m/ M: J
The AuthorisedUsers class: (Total maximum 20 marks available)- ^& C! F" F& Q* ^
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 [6 M8 l5 L& E7 }1 { {$ G0 N
4. Provide methods to:
3 `. f: l+ }. C, Z* Na) 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
3 C$ n) E( `2 E% F/ n. G' Kb) return the name of the authorised user
' d, q; B" `' F |$ r; Qc) return the name of the department of the authorised user& w) ~8 ^ m8 O8 F* U
Individual Data (Maximum 20 marks available); W1 k/ g, Z" E( 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.1 d. b; P9 _% ]2 @5 C% g9 d% \
Documentation (Maximum 10 marks available)
! O: U) {/ y7 T6 C( j6. 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. i- F {, Y. d- U- C. R- CBSA104 Business Programming – 2007: Assignment 2
. ~8 { |9 Y5 O; wPage 3 of 5 |
|