Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Add more static methods to the Future Value application In this exercise, you'll add two more static methods to the Future Value application that you

 Add more static methods to the Future Value application In this exercise, you'll add two more static methods to the Future Value application that you saw at the end of this chapter. When you're done, the main) method should be even easier to read and understand.


Open and test the project


1. Open the project named ch05_exI_Future Value in the ex_starts directory.


2 Review the FutureValue App.java file, and notice how the code in the main) method calls the other methods in the file. Then, test the application to see how it works.


Add a method for displaying the results


3. Add a static method named printFormattedResults() anywhere in the file. This method should have private scope and a void return type, and it should accept the following parameters: a double named monthlylnvestment, a double named interestRate, an int named years, and a double named future Value


4. Move the code in the main) method that creates two NumberFormat objects, uses them to create a string, and then prints that string to the printFormattedFuture ValueResults (0 method.


5. Add code to the main) method that calls the printFormattedResults() method and passes it the values entered by the user, along with the value in the future Value variable. Then, test this enhancement to make sure the application still works properly.


Add a method for asking if the user wants to continue


6. Add another static method named askToContinue() anywhere in the file. This method should have public scope and a void return type, and it should accept a Scanner object named sc.


7. Move the code in the main) method that asks if the user wants to continue to the askToContinue() method. Then, adjust this code so it declares the choice variable as a String and so it returns the choice variable.


8. Add code to the main) method that passes the Scanner object to the askloContinue() method and stores the result in the choice variable. Then, test this enhancement to make sure the application still works properly.

Step by Step Solution

3.47 Rating (160 Votes )

There are 3 Steps involved in it

Step: 1

Heres the modified FutureValueAppjava file with the added static methods printFormattedResults and a... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Excellence in Business Communication

Authors: John V. Thill, Courtland L. Bovee

9th edition

136103766, 978-0136103769

More Books

Students also viewed these Programming questions

Question

Is an executive summary a persuasive message? Explain your answer.

Answered: 1 week ago

Question

2. In what way are fi sh movements impaired in cold water?

Answered: 1 week ago