|
汗,真是不知道怎么写,同学找了个哥哥,3个小时就搞定了,我编了3天,还有100多个错,可怕啊& @: x* Y7 o. x/ u
有没有高手帮我哦,周5就要交了,我的邮箱是[email protected],谢谢啦
: G7 _+ ]$ B* V% U4 q" }6 {Requirements: ( K/ W0 f0 D! K/ A& P6 y$ L
Consider the three Java Classes: Borrow, RepayCalc and RepayCalcMenu, available from the ( h: C7 J3 {) ] ^
Assignment 2 page on Vista.
7 r9 G8 @: n" c4 @ x; g+ G 4 r* h, S/ c( Y0 t, G
You are required to perform the following tasks: ; m+ h6 x4 W4 y
2 }( N4 u+ r/ F9 @& i/ P# a0 j3 x% K
The RepayCalcMenu class: (Total maximum 20 marks available)
) g! N% P" g6 R) z) l% e* }$ V1 c" ?3 ]& y* P d3 c7 W, |" ?) P
1. Provide a basic text-based interface to a Repayment Calculator for the Megalodon . t/ S' w6 b' ~2 ~" d7 _
Finance Company so that it can be used by the Megalodon staff members to 3 P% w! G& ?- q% k( S
determine repayment options for their clients.
' f5 N0 g. Z7 l' E! M" @* s0 g7 F% U) \" J7 [
The staff must be able to:
6 h5 ?( ] j) [" }5 R$ U
' k8 L% S( P2 A0 T' e8 I$ R * Log on to the ‘system’ using their user name and a Personal Identification ' R4 p- w( f# U! v B$ B
Number (PIN), which a four digit number **.
! A( B" \8 @ N! t& [/ l3 z8 A5 X5 ]% B5 B! h2 p
* The user should not be able to use the ‘system’ until they have provided the
) W9 x- k5 f; `3 e correct user name and PIN combination. You should give them a second or ) a6 {8 v B1 J( U; f( x9 x4 Y: v
third chance to get it right before shutting the ‘system’ down.
9 T2 l; X2 [/ I* {$ I# [8 T$ W0 O R: a6 U5 y2 I; m
2 u* R( l4 t2 _6 ~
- f' B0 T' M# r( u8 T! C0 H: R2 F ** You must use the user names and passwords provided in your individual ! ?% `, s: H. Y8 l. f
4 M# l8 T3 `* q4 u" M# {
data available from the Assignment 2 page on Vista (see requirement 5 below). 9 \ _1 M0 s0 Z( k: X
The user names and passwords should be included in your code, and the output
7 D2 ^6 D: g2 l9 ~9 c: e s | to the screen should prompt the user with the user names and passwords (for
3 i9 X6 S& E9 V4 ^* I- R7 H# ]: c0 W" h3 v; w/ a2 M }
marking purposes). , `. _) y5 {( V$ d" S& g" X
$ q7 Z; x9 f: z- I1 B: V: D
8 t8 W6 w; _$ r# m3 n
1 F5 ~' O8 @& Y. V% y* The interface should provide a menu so that the staff can:
' t- {0 V- O) z6 `* g, g2 |& D/ o' S$ n, k' w" F: x+ ?) S( P; ~2 i
- Perform a Repayment calculation
' C3 L2 W! @. C0 o* L D
9 r5 r: B6 Q; ` D+ |2 D - Print out to the screen the Repayment details
" b7 J1 X2 H7 _) w# b' g; [
, n6 g* z9 ]7 b3 y0 J - Change one, two, or all of the values for the current calculation
) {7 m$ Y& |' i* [4 e% H( G
" S0 }' L1 N$ o/ E1 L4 } - Start a new calculation
0 Y. Y3 r. M4 S* y4 r5 K# x/ E; X: q) Q; \. f- {4 R* F& z
- Leave the program. : |% I" d& X7 Q7 c: t4 h! R
The RepayCalc class: (Total maximum 10 marks available) - \0 I& Q" F' U4 r3 n4 z" K
# x( P* ~2 }8 w7 v9 h6 L 2. Provide a method to accept three input values from the user:
/ w% I0 S8 r- n& S
" L, n; ~1 Z- H# W. } i% Z - the Amount to be Borrowed (to 2 decimal places, for example, 10550.00)
4 Z; f/ C7 [! t. ~$ i6 K) p P3 G' \ K( s! d0 Y! G$ x' J; ^; ~! \
- the Annual Interest Rate (to 2 decimal places, for example, 9.75)
+ u& \4 Q9 Z* H4 ~" p) L" ^: Z; R: }# M% e; E O6 }: |/ e" P- s
- the Period of Repayment (in whole Years, that is, no fractions of a year)
7 S u! q. Y, ]9 j2 b7 @# o5 p+ t* ~+ ^' _$ U7 R3 _* W1 T
3. Provide a method to print out to the screen the three input values (accepted in 6 k. U- Y2 a( l( K9 k) I
requirement 2), plus the repayment calculations:
% k9 q; A) n9 n/ Y5 G8 d0 ]1 h+ D" O2 L( W# P
- the Weekly repayments
% [" m! e- }& p# p$ Z, Y0 H
: e7 L7 y0 E! e! M# u0 t# `3 b - the Total repayment amount (Amount borrowed + Interest)
& V& i6 ]2 h2 X X3 U5 k1 r6 N, m6 m( X5 _% J
/ @) P* y e% R
) a7 B' |( ~ g7 |/ U- X8 aThe Borrow class: (Total maximum 40 marks available)
' W5 v9 d6 c) O( p7 ^! t
; v2 d5 ?0 ~# v* c 4. Provide methods to perform the following tasks: + z& h7 W+ l6 I0 r" t$ ]# O5 ~# c
, i9 i% Z& `) d2 n" L) H, Q - to calculate the weekly repayments ***
! o5 f; a9 B6 _2 P( \! S3 U" X. [$ j) S& @
- to calculate the total repayment amount , s* n2 _1 j }# x
- z, y9 [7 ]0 \ e+ p0 T0 U
- to return the amount borrowed * ^* _+ E( D" b5 j. H
% z+ W( T" I! u: R! l
- to return the borrowing period in years s/ d, f# t/ L2 }' F3 p6 U3 W4 O. E: G
' a8 O- [2 e2 y; a, F - to return the borrowing period in weeks . ^1 _! ^) N: r2 q+ O$ v% a% ?7 ^
9 c" o2 m8 {5 s; ?& @& v - to return the annual interest rate
+ h4 x* K- i% X+ ?4 Y) K; B5 c$ P2 t% o) i0 D2 S0 b
- to return the weekly repayments , V, R4 d' R9 U \: a
1 y1 E9 \+ F% P5 U3 f( {7 ?% Z - to return the total repayment amount + G1 G3 z; b' f% i9 q) A
# ^) g: ~+ N6 v0 r( @1 Q - to reset the loan amount * g- X1 K' Z: y
3 o9 T2 K8 e4 o - to reset the annual interest rate : |& ^* B& |7 t p
# }# L% ~1 ^; d9 m4 E. w
- to reset the loan period (in years)
( u5 t$ A2 \( N# L0 ~2 F; N6 u. R/ k+ S$ T9 f
3 a7 w; C: o. Q6 Q5 J
$ K/ u/ @+ h( @% } 3 F1 R0 |6 s8 c2 M0 u. j
8 r, j* m2 t! c7 b
*** Use a simple interest calculation (not compound) formula, for example:
% B# k7 c% r0 ^3 h4 W1 Q: e; s & s( v1 ?/ `4 F/ B4 ~- L
weeklyRepayment = (borrowedAmount * 1 + (annualInterestRate *
8 s- z, e# c* k4 Q- T6 v; I, U numberOfYears )) / numberOfPayments; 7 ^9 J$ k. P# ~% Y3 T, U
: v$ O, o! {# c! A5 j* b A9 R5 [
# ~1 n0 ^0 b1 A. O. B2 g# |- X* P
' h- g/ d4 t4 l. m" d/ u5 c $ z% \# a' P0 G' x8 W
/ o6 o7 J3 X: @. _* V& z) \: \% eIndividual Data (Maximum 10 marks available) / u) D1 i0 r# X- X' S5 j
; q: ?# R) m) L+ F' X 5. You will be given two Megalodon staff member user names and passwords, plus a set 6 M: X- V1 x+ ]4 \% s# ~7 y
of data for each staff member to use to calculate repayment details. You will need to
{. D! w/ D; x7 c. L, @ log onto the BSA104 Assignment 2 page on Vista to generate your individual data
0 T# X2 _% ~# ?7 }9 K9 Z* A( e1 d and instructions for this requirement. You will need to use your University of 6 i, x0 q5 u. ~# H/ C& p
Tasmania (UTas) student number.
: K3 y# B9 V3 f7 Q- C
% k5 a8 Y, S. B$ m" v
/ F1 G; G' B) I- T) ]8 k( J) B Page 2 of 5
$ j" N% E! L8 w! _ {* t' p: I( U9 C- H5 y- d
For requirement 5 use the following data:9 V7 X/ J0 [3 x5 W5 ?6 E. X( ^' S
n& D7 `* ]' I1 O3 J+ M1 B
# Data Set 1:
1 d x+ t- F3 F( c1 ]9 d9 d1 W
User name: JordanM
9 J4 T! P4 ~0 ?. D8 V8 k! [Password: Ferrari o( C' q0 t6 w$ [5 a
Borrowed: $ 749.95
1 ^& v% K& ]; d; G$ d0 l2 aInterest: 15.0 %
* _) L _* Z+ NYears: 4
) l/ X- r% y9 r0 k/ W" v
" }0 m8 ]8 u% D$ ^; Y( j# Data Set 2:
6 E4 ?5 _- F' Y3 Y0 I0 G5 s! o# Q7 |2 j: p) k7 X5 a! _: K# a
User name: KimZ
7 I- d2 X4 x$ B. H: c2 Q" d+ }- H% JPassword: DimSim" f; F9 s4 X2 U4 Q+ S
Borrowed: $ 150500.256 t I0 G- ]- S9 @) R
Interest: 5.5 %
$ _! s0 w I0 w' \0 X! HYears: 7
/ ]( b" ?# n. K
3 q+ L8 R7 H1 [ N- o[ 本帖最后由 wwwsnailcom 于 2006-5-24 02:15 AM 编辑 ] |
|