|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming
# M2 }, O$ v, O6 BShanghai - 2007; g s3 X E; s, s- A4 W; R) @
Assignment 2
! ~7 A0 e' R6 b6 M- U% V8 UDeadline 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)
2 `/ U8 W# v2 `" _- a0 f( P# p1. 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.% P* a' o9 `" P; H
The staff must be able to:/ k2 a4 G6 k6 X* t9 C+ h/ J
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **.# J" Y$ P& m1 ^9 c
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.& X: i0 V' W# V! t; n o
 The interface should provide a menu so that the staff can:6 A7 H6 h& s- S) j2 f6 Z
a) Enter the names of the two Java program files to be compared! o+ a4 k5 `, ~# f8 }% P
 For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
8 B, B" _; ~+ X" i3 J6 U** 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).
. B0 ~1 n3 {0 |2 h, n0 p% CBSA104 Business Programming – 2007: Assignment 20 h! a/ E1 J% K. ~* L% G1 ^
Page 2 of 5" h# l a; v0 T/ U
b) Print out to the screen all the lines of code that are the same
6 k+ ?- v: b s+ H& g Include the name of the file and the line number of the code being printed for each of the two files
0 N/ ^3 N1 K6 Q, fc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared: [5 V, E' p+ I
 the name, username and department of the user& a- E- N a- x% Z* b
 the statistics of the comparison
% @* B* g2 v5 K8 V2 d& w- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different0 D: _& B- P( ~: J z& c: c* l
 the recommendation for further checking/ b- v* M I# c G/ `
- 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, Q, m2 `/ u8 m/ X the names of the two files compared% Q* m$ A" U+ l- s# `; ~0 _, a+ h
d) Leave the program (exit)
5 g; B4 G' B) q! J! Q- qThe ProgramCompare class: (Total maximum 20 marks available)- M. p" e5 e% U4 S* u
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)
" f; R* S I& ~a) provide an error message if the files are not found or there is a problem opening them4 d0 J- {9 b, f5 P! U6 v
b) compare each line of code
1 ~: T9 C$ Y& Kc) print out the lines that are the same
4 H4 A$ R; g4 f$ y9 r5 M9 Jd) count the number of lines compared / lines the same4 ^$ ^! z) M& W @
The AuthorisedUsers class: (Total maximum 20 marks available)
5 x: g, Q' x9 W/ g# C3. 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)
2 @+ e% f) F" D4. Provide methods to:, B& |0 |# P6 F! E( Z4 h# r
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( V' u8 m6 A# j1 b8 s c7 R
b) return the name of the authorised user1 g$ [ T+ J' v4 w' w
c) return the name of the department of the authorised user( O9 t) s' } C9 S6 q: b
Individual Data (Maximum 20 marks available)
. {. a p' P, }7 [* X5. 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.
+ Y4 P$ W# v! h* w$ h, FDocumentation (Maximum 10 marks available)
) Q' F+ X3 ]; S6 |( I4 z+ 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.7 P% F0 j+ Y; Y3 g' h9 q8 c; U
BSA104 Business Programming – 2007: Assignment 2
3 V3 E% N/ Y$ A( L4 E- nPage 3 of 5 |
|