Surjit Singh

Greenhorn

Posts: 1

posted 6 years ago

We have to write methods that perform financial calculations. Interest rates will be expressed as percentages out of 100. For example, 2.45% will be expressed as the number 2.45, not 0.0245. If you detect an error condition, return -1.

public static double computeApy(double annualRate, int compoundingOption): Compute the Annual Percentage Yield (APY) on a deposit account using the following formula: APY formula (use the first formula listed on this page). The compounding option can be one of the following values:

1 -> daily

2 -> monthly

3 -> annually

public static double computeLoanPayment(double principal, double annualRate, double yearsDuration, int paymentOption): Compute the periodic payment needed to repay a loan, using the following formula: periodic payment formula. The payment option can be one of the following values:

1 -> biweekly (every two weeks - assume a year is exactly 52 weeks)

2 -> monthly

3 -> quarterly (four times a year)

And we are not allowed to use IO to ask the user for the information. Please help me with this assignment.

public static double computeApy(double annualRate, int compoundingOption): Compute the Annual Percentage Yield (APY) on a deposit account using the following formula: APY formula (use the first formula listed on this page). The compounding option can be one of the following values:

1 -> daily

2 -> monthly

3 -> annually

public static double computeLoanPayment(double principal, double annualRate, double yearsDuration, int paymentOption): Compute the periodic payment needed to repay a loan, using the following formula: periodic payment formula. The payment option can be one of the following values:

1 -> biweekly (every two weeks - assume a year is exactly 52 weeks)

2 -> monthly

3 -> quarterly (four times a year)

And we are not allowed to use IO to ask the user for the information. Please help me with this assignment.

posted 6 years ago

- 1

With such a broad question, you can really only expect broad answers. So:

plan it out on paper first. write in small chunks compile and test OFTEN - every 2-3 lines at most When you are done testing, test more.

There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors