Let A = {5, 6, 7, 8, 9} and let set B = {x| x is a natural number greater than 8}. Determine whether the following is true or false.
Answer the following statement true (T) or false (F)
True
You might also like to view...
Given a movie clip that contains an animation sequence spanning 10 frames within its own Timeline, when that clip is used in a document, its 10 frames occupy 10 frames in the document's Timeline.
Answer the following statement true (T) or false (F)
A bank wants to show its customers how much they would need to invest to achieve a specified financial goal (future value) in 5, 10, 15, 20, 25 or 30 years. Users must provide their financial goal (the amount of money desired after the specified number of years has elapsed), an interest rate and the length of the invest- ment in years. Create an application that calculates and displays the principal (initial amount to invest) needed to achieve the user’s financial goal. Your application should allow the user to invest money for 5, 10, 15, 20, 25 or 30 years. For example, if a customer wants to reach the financial goal of $15,000 over a period of 5 years when the interest rate is 6.6%, the customer would need to invest $10,896.96 as shown in Fig. 10.28.
a) Copying the template to your working directory. Copy the C:\Examples\Tutorial10\Exercises\PresentValue directory to your C:\SimplyJava directory.
b) Opening the template file. Open the PresentValue.java file in your text editor.
c) Customizing the JSpinner. You must customize the JSpinner to display the number of years. The name of this JSpinner is yearsJSpinner. This JSpinner should dis- play every multiple of 5 from 0 to 30, inclusive. Modify line 83 so that the initial value in the JSpinner is 0, the minimum value is 0, the maximum value is 30 and the step size is 5. In line 84, insert code to set the bounds property to 130, 95, 100, 20.
d) Customizing the JTextArea. You must customize the JTextArea that will display the various amounts needed on deposit. The name of this JTextArea is amountNeededJ- TextArea. Insert a blank line at line 94. On line 95, insert code to set the bounds property to 20, 155, 320, 115. On the next line, insert code to set amountNeeded- JTextArea’s editable property to false.
e) Retrieving input from a JSpinner. In line 133, access the JSpinner’s value property and use the ( Integer ) cast to convert the result to an object of type Integer. Store the result in Integer object integerObject. Insert a blank line at line 133. On line 134, retrieve the int data in integerObject, and store this data in int variable
years.
f) Completing a for statement header. In line 140 you will see a for statement header with only two semicolons. Before the first semicolon, declare and initialize variable counter to 5. Before the second semicolon, enter a loop-continuation condition that will cause the for statement to loop until counter has reached the number of years specified by the user. After the second semicolon, enter the increment of counter so that the for statement executes for every fifth year.
g) Calculating present values. You will now calculate the amount needed to achieve the future value for each five-year interval. To do this, you will need to implement the following formula within the for statement:
p = a / (1 + r) n
where
p is the amount needed to achieve the future value
r is the annual interest rate
n is the number of years
a is the future value amount (the amount the user would like to have after n years)
In lines 142–143, use the Math.pow method (as well as the variables defined for you in lines 129 and 131) to calculate the present value needed for the current number of years. Use two lines for clarity. In lines 144–145, use the append method to output the present value calculated in the application’s JTextArea. Use the DecimalFormat object (dollars) created for you in line 137. Use two lines for clarity.
h) Saving the application. Save your modified source code file.
i) Opening the Command Prompt window and changing directories. Open the Com- mand Prompt window by selecting Start > Programs > Accessories > Command Prompt. Change to your working directory by typing cd C:\SimplyJava\PresentValue.
j) Compiling the application. Compile your application by typing javac PresentValue.java.
k) Running the completed application. When your application compiles correctly, run it by typing java PresentValue. Input a future value, interest rate and a number of years, then click the Calculate JButton. View the results to ensure that the correct number of years is displayed, and that the initial deposit results are correct.
l) Closing the application. Close your running application by clicking its close button. m) Closing the Command Prompt window. Close the Command Prompt window by clicking its close button.