|
|
楼主 |
发表于 2007-5-9 14:03:32
|
显示全部楼层
BSA104 Business Programming- h, n6 l/ ^* Z: V+ u
Shanghai - 20070 l8 |& s! _( g" @) t
Assignment 2
& A8 A) p# w7 t9 i7 g/ K+ GDeadline 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), j+ y! L" T) D. V, V- U
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.
8 n" x4 B$ B) A: vThe staff must be able to:1 _# o8 z2 F% N& d* f# }; o, k
 Log on to the „system‟ using their user name, and a Personal Identification Number (PIN) which is a four digit number **./ r, [# F$ u S* R
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.' N5 l5 {* w. V& y9 |6 Z
 The interface should provide a menu so that the staff can:
4 e% [ a; B( j: [9 E# |$ Da) Enter the names of the two Java program files to be compared
) o7 f# R/ J8 S5 J0 U For this assignment, it will be assumed that the two Java program files are in the same folder as your program.
" }1 z8 v9 s/ b** 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). v k" Z8 E; r$ f) R* N3 T
BSA104 Business Programming – 2007: Assignment 2
* ^+ _+ _1 j" nPage 2 of 5# l o1 Z( a( y g" U
b) Print out to the screen all the lines of code that are the same7 r5 A6 L) S; D2 @
 Include the name of the file and the line number of the code being printed for each of the two files
9 [9 v7 k% H; Wc) Print out to the screen all the available information regarding the evaluation of the two Java program files being compared
0 @2 f- `3 j4 k the name, username and department of the user! t# l* f; _; R! F, n
 the statistics of the comparison. y6 o- C9 y0 |2 S V$ Z+ ]) s% g
- For example: the number of lines of code checked, the number of lines the same, the number of lines that are different: l$ n" H& a3 p% ?
 the recommendation for further checking' P( }# z+ j* x' w6 j5 A% 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
D G$ i m: s, k the names of the two files compared
8 m/ w. l) Y5 l8 \- T/ e; Ed) Leave the program (exit)0 W) o( S$ j7 y) L
The ProgramCompare class: (Total maximum 20 marks available)
/ u4 n7 _ n8 O& E$ J, G2. 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): K# c$ v+ O/ [4 E' `8 ^
a) provide an error message if the files are not found or there is a problem opening them
5 n- V/ ?3 } e* }* z) _b) compare each line of code
" F6 ] U6 x; D9 R9 P, W0 s8 zc) print out the lines that are the same* Y& T, Y; U5 Y g: N8 S. i" J5 p$ ^
d) count the number of lines compared / lines the same v9 s" h( N# q) F& R) l; F
The AuthorisedUsers class: (Total maximum 20 marks available)
0 J6 K# i$ n: Q6 y! @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)
" e% ]. V# `2 v4 ?( K0 D' k: k4. Provide methods to:
& M0 Z I2 Y1 A* Q% e/ H& w! xa) compare the stored username and PIN with the one entered by the user - return a value that indicates whether they match or do not match5 f7 s$ I- t3 z& }
b) return the name of the authorised user$ }. o4 A. z( T+ W! s3 L
c) return the name of the department of the authorised user
! I4 _0 |0 [5 M2 R5 ^Individual Data (Maximum 20 marks available)6 A! x& w5 m k( O
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.
7 G6 E9 C4 Q2 ~! hDocumentation (Maximum 10 marks available)2 g2 ~3 \0 ]9 {/ T9 L# z+ t
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.# v6 M. l; V( l1 o1 n2 K
BSA104 Business Programming – 2007: Assignment 2$ Q9 O o- ` U4 C& ]3 H7 U9 \% z5 g( f' n
Page 3 of 5 |
|