Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

need someone to solve this problem for me


Interest on credit card accounts can be quite high. Most credit card companies compute interest on an average daily balance. Here is an algorithm for computing the average daily balance and the monthly interest charge on a credit card.

Step 1. Multiply the net balance shown on the statement by the number of days in. the billing cycle.
Step 2. Multiply the net payment received by the number of days the payment was received before the statement date.
Step 3. Subtract the result of the calculation in step 2 from the result of the calculation in step l.
Step 4. Di:vide the result of step 3 by the number of days in the billing cycle.
This value is the average daily balance.
Step 5. Complete the interest charge for the billing period by multiplying the average daily balance by the monthly interest rate.

Here is an example to illustrate the algorithm. Suppose a credit card statement showed a previous balance of $850. Eleven days before the end of the billing cycle, a payment of $400 is made. The billing cycle for the month is 31 days, and the monthly interest rate is 1.32%. The calculation of the interest charge is as follows:

Step 1. $850 x 31 = $26,350
Step 2. $400 x 11 = $4,400
Step 3. $26,350 - $4,400 = $21,950 Step
4. $21,950 + 31 = $708.06
Step 5. $708.06 x 0.0132 = $9.34

Write a program that computes the monthly interest charge on a credit card account. Your program should acquire as input the previous balance, the payment amount, the number of days in the billing cycle, the day of the billing cycle the payment was made, and the monthly interest rate.
2.40 Suppose a, b, and c are int variables initialized respectively to 1, 2, and 3. What values are assigned to e, f, and g?

a) int e = ++a;
b) int f = b++;
c) int 9 = ++c + c++;

Write a code segment that defines a Scanner variable stdi n that is associated with System. i n. The code segment should then define two i nt variables a and b such that they are initialized with the next two input values from the standard input stream.