Reate a new method to calculate the compound value

Assignment Help Basic Computer Science
Reference no: EM13850765

Problem Description

This lab assignment is to improve the solution of computing the monthly saving problem in Lab Assignment 3 by using a loop to eliminate the repeated calculations. That is, all the requirements of Lab 3 remain the same, but the solution to the problem is changed.

Assignment Requirements

The requirements of Lab 3 remain the same except the following changes:

1) Modify the flowchart diagram for Lab 3 assignment to reflect the change of the solution, i.e., the use of a loop to replace the repeated calculations.

2) Modify the pseudo-code in Lab 3 Assignment, accordingly.

3) Continue to use the JOptionPane class for all input and output, instead of the Scanner object.

4) Perform all input data error checking as required in Lab 3.

(The above requirements are also applicable to the bonus problem.)

The following three test runs in Lab Assignment 3 should be rerun to confirm the program produces the correct answers:

 

Saving Amount

Annual Interest Rate

Compound Value after 6th Month

Test run 1

100

5.0

608.81

Test run 2

150

5.0

913.22

Test run 3

100

5.5

609.70

When the monthly saving amount or the annual interest rate or both are not positive, your program should display informative error messages. Your test case should include the following three possible casesIt is your choice of the test data covering those three test cases listed above.

Saving Amount

Annual Interest Rate

Positive

Not positive

Not positive

Positive

Not positive

Not positive


Submission Requirements

Your assignment submission should be prepared as follows:

1) The flowchart diagram document

2) The Java source code file (i.e., *.java file) you write for this assignment

3) The MS Word document containing the screen captures of all test cases you run, making sure the screens show the input and output. To receive the credit for completing testing, your screen captures should include all test cases as specified above.

Submit all files above into the dropbox of this assignment.

(Bonus Problem:

Enhance the function of the application to allow the user to compare the compound values of different annual interest rates. The user enters the monthly saving amount and an annual interest rate. The program computes the compound value after month 6 and display the result.
The program then asks if the user wants to compute the compound value of a different rate using the Java confirmation dialog box. If the user clicks the Yes button, the program should then prompt the user to enter a new set of data and repeat the same calculation. If the user clicks the No button, the program would then end. The user should be able to try several different rates.
Successful completion of this task will add 25 points to the assignment.)


Assignment Assessment
The assessment rubric for the assignment is below:

Task Items

Complete & Correct

Incomplete/
Partially Correct

Missing

Solution Design
(flowchart diagram) (15%)

100%

By %

0

Solution Pseudo-Code (Java comments) (10%)

100%

By %

0

Java Program (60%)

100%

By %

0

Testing Completeness (15%)

100%

By %

0

Problem Description

The calculation of the compound value we have done in the last three assignments is a very common financial calculation in many financial applications. For example, producing the monthly account statements requires calculating the compound value of bank accounts. Thus, making the calculation readily available to financial applications can reduce the development effort and improve the quality of those applications.

Java methods allow us to package such financial calculations into reusable methods so that they are ready to be invoked by financial applications. This lab assignment is to improve the solution of computing the monthly saving problem in Lab Assignment 4 by extracting the calculation of the compound value into a separate method. The main learning objective is to understand method definition, parameter passing, and method invocation.

Assignment Requirements

Create a new method to calculate the compound value of monthly savings. The requirements of the new method are described below:

1) The modifiers of the method should be public static so that it can be called by the main method

2) The method should return the calculated compound value and the return value type of the method is of double type

3) The name of the method is your choice but should be descriptive and follow the Java naming convention.

4) The parameter list of the method should consist of the following three parameters:

a. The amount of monthly saving (double type)

b. The annual interest rate (double type)

c. The number of months (int type) of the compound value

5) The method should perform the following tasks:

a. Validate each parameter. If a parameter is not positive, display an error message and terminate the method by returning a negative compound value to signal that the calculation failed. Note that it takes only one data error to terminate the calculation.

b. If all parameters are positive, use a loop to calculate the compound value same as you did in Lab Assignment 4. The number of months to repeat is determined by the number of months parameter passed into the method.

c. After the calculation is completed, return the compound value after the given number of months.

The main method is now simplified to do only the following tasks:

1) Prompt the user to input the data and read the data entered by the user.

2) Call the new method to calculate the compound value by passing the monthly saving, annual interest rate, and the number of months as arguments and save the compound value returned by the method

3) If the compound value returned by the method call is positive, display the compound value. Otherwise, simply end the execution of the main method because the error message has already been reported in the method.

Because of the above changes, the flowchart diagram of Lab Assignment 4 should be modified to reflect the changes taken place in your program. If you did the bonus problem in Lab Assignment 4, you may use either your bonus solution or the regular solution as the base for this assignment

The requirement of using GUI dialog boxes for all input and output remains unchanged.

You should run the same number of test cases as required in Lab Assignment 4.

Bonus: 10% of your total score on this assignment will be added to your assignment grade

Submission Requirements

Your assignment submission should include the following items:

1) The modified flowchart diagram

2) The Java source code file (i.e., *.java file)

3) The screen captures of all test cases you run; only the dialog boxes need to be captured.

Submit all those files above into the dropbox of this assignment.

Assignment Assessment

The assessment rubric for the assignment is below:

Task Items

Complete & Correct

Incomplete/
Partially Correct

Missing

Solution Design
(flowchart diagram) (15%)

100%

By %

0

Solution Pseudo-Code (Java comments) (10%)

100%

By %

0

Java Program (60%)

100%

By %

0

Testing Completeness (15%)

100%

By %

0

Reference no: EM13850765

Questions Cloud

What is the firms market value capital structure : Titan Mining Corporation has 9.3 million shares of common stock outstanding and 370,000 6 percent semiannual bonds outstanding, par value $1,000 each. The common stock currently sells for $41 per share and has a beta of 1.15, and the bonds have 20 ye..
Identify a company that might use the chase strategy : Identify a company that might use the chase strategy? Identify a second company that might use the chase strategy? What are some of the challenges associated with using the chase strategy and why
The firms cost preferred stock financing : The Preferred stock of Gator industries sells for $34.55 and pays $2.74 per year in dividends. What is the cost of preferred stock financing? If Gator were to issue 469,000 more preferred shares just like ones it currently has outstanding, it could s..
How is beauty prejudice similar to other forms : How is beauty prejudice similar to other forms of discrimination, such as racism and sexism, both personally and in a workplace? Your response must be at least 200 words in length. You are required to use at least your textbook as source material for..
Reate a new method to calculate the compound value : reate a new method to calculate the compound value of monthly savings
Refuse to renew the loan and bankruptcy will result : The Morris Corporation has $600,000 of debt outstanding, and it pays an interest rate of 8% annually. Morris’s annual sales are $3 million, its average tax rate is 40%, and its net profit margin on sales is 3%. If the company does not maintain a TIE ..
Describe the delphi method and give an example : What is Linear regression forecasting, and give an example. Describe the Delphi method and give an example.  What are some Strategies used by supermarkets, airlines, hospitals, banks, and cereal manufacturers to influence demand
Constant-growth dividend discount model : A firm pays a current dividend of $2, which is expected to grow at a rate of 8% indefinitely. If the current value of the firm’s shares is $54, what is the required return applicable to the investment based on the constant-growth dividend discount mo..
Impact does the aging population : What impact does the aging population have on how families are structured? How might the aging population affect you personally, in terms of allocation of your family's time and money? How do you think having older people will affect government po..

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd