Finding the Maximum Annuity for a Given Investment in Java

Create QR Code in Java Finding the Maximum Annuity for a Given Investment

Finding the Maximum Annuity for a Given Investment
QR Code JIS X 0510 Creation In Java
Using Barcode encoder for Java Control to generate, create Quick Response Code image in Java applications.
QR Decoder In Java
Using Barcode decoder for Java Control to read, scan read, scan image in Java applications.
Another annuity calculation computes the maximum annuity (in terms of a regular withdrawal) available from a given investment over a specified period of time For example, if you have
Barcode Encoder In Java
Using Barcode printer for Java Control to generate, create barcode image in Java applications.
Bar Code Reader In Java
Using Barcode reader for Java Control to read, scan read, scan image in Java applications.
Part IV:
Generating QR Code 2d Barcode In Visual C#.NET
Using Barcode printer for .NET Control to generate, create Quick Response Code image in .NET framework applications.
Quick Response Code Encoder In .NET
Using Barcode creator for ASP.NET Control to generate, create QR-Code image in ASP.NET applications.
Applying Java
Generating Denso QR Bar Code In VS .NET
Using Barcode creator for .NET Control to generate, create QR Code ISO/IEC18004 image in Visual Studio .NET applications.
QR Generator In Visual Basic .NET
Using Barcode generation for VS .NET Control to generate, create QR-Code image in VS .NET applications.
FIGURE 32-5
Generating Code39 In Java
Using Barcode drawer for Java Control to generate, create Code-39 image in Java applications.
ECC200 Generator In Java
Using Barcode encoder for Java Control to generate, create Data Matrix 2d barcode image in Java applications.
The MaxWD applet
Create GS1 DataBar-14 In Java
Using Barcode creator for Java Control to generate, create GS1 DataBar-14 image in Java applications.
Generating USS-128 In Java
Using Barcode creation for Java Control to generate, create USS-128 image in Java applications.
$500,000 in a retirement account, how much can you take out each month for 20 years, assuming a 6 percent rate of return The formula that computes the maximum withdrawal is shown here: Maximum Withdrawal = principal * ( ( (rateOfRet / wdPerYear) / ( 1 + ((rateOfRet / wdPerYear) + 1) wdPerYear * numYears) ) + (rateOfRet / wdPerYear) ) where rateOfRet specifies the rate of return, principal contains the value of the initial investment, wdPerYear specifies the number of withdrawals per year, and numYears specifies the length of the annuity in years The MaxWD applet shown next computes the maximum periodic withdrawals that can be made over a specified length of time for an assumed rate of return The applet produced by this program is shown in Figure 32-5
Print Identcode In Java
Using Barcode generation for Java Control to generate, create Identcode image in Java applications.
Draw Code 128B In Java
Using Barcode creation for Android Control to generate, create Code 128 image in Android applications.
/* Compute the maximum annuity that can be withdrawn from an investment over a period of time */ import javaawt*; import javaawtevent*; import javaxswing*; import javatext*; /* <applet code="MaxWD" width=340 height=260> </applet> */ public class MaxWD extends JApplet implements ActionListener { JTextField maxWDText, orgPText, periodText, rateText, numWDText; JButton doIt; double principal; double rateOfRet; double numYears; int numPerYear; NumberFormat nf; // // // // initial principal annual rate of return length of time in years number of withdrawals per year
Create EAN / UCC - 14 In Java
Using Barcode drawer for Android Control to generate, create GTIN - 128 image in Android applications.
Painting EAN 13 In Objective-C
Using Barcode creator for iPhone Control to generate, create EAN-13 Supplement 5 image in iPhone applications.
32:
Scanning Code 39 In None
Using Barcode scanner for Software Control to read, scan read, scan image in Software applications.
GS1 - 12 Creation In Visual Basic .NET
Using Barcode drawer for .NET framework Control to generate, create UPC-A image in VS .NET applications.
Financial Applets and Servlets
Encode Bar Code In .NET Framework
Using Barcode printer for VS .NET Control to generate, create bar code image in Visual Studio .NET applications.
Code 128C Generation In .NET Framework
Using Barcode generator for Reporting Service Control to generate, create Code 128C image in Reporting Service applications.
public void init() { try { SwingUtilitiesinvokeAndWait(new Runnable () { public void run() { makeGUI(); // initialize the GUI } }); } catch(Exception exc) { Systemoutprintln("Can't create because of "+ exc); } } // Set up and initialize the GUI private void makeGUI() { // Use a grid bag layout GridBagLayout gbag = new GridBagLayout(); GridBagConstraints gbc = new GridBagConstraints(); setLayout(gbag); JLabel heading = new JLabel("Maximum Regular Withdrawals"); JLabel JLabel JLabel JLabel orgPLab = new JLabel("Original Principal "); periodLab = new JLabel("Years "); rateLab = new JLabel("Rate of Return "); numWDLab = new JLabel("Number of Withdrawals per Year "); JLabel maxWDLab = new JLabel("Maximum Withdrawal "); maxWDText = new JTextField(10); periodText = new JTextField(10); orgPText = new JTextField(10); rateText = new JTextField(10); numWDText = new JTextField(10); // Max withdrawal field for display only maxWDTextsetEditable(false); doIt = new JButton("Compute"); // Define the grid bag gbcweighty = 10; // use a row weight of 1 gbcgridwidth = GridBagConstraintsREMAINDER; gbcanchor = GridBagConstraintsNORTH; gbagsetConstraints(heading, gbc); // Anchor most components to the right gbcanchor = GridBagConstraintsEAST; gbcgridwidth = GridBagConstraintsRELATIVE; gbagsetConstraints(orgPLab, gbc); gbcgridwidth = GridBagConstraintsREMAINDER; gbagsetConstraints(orgPText, gbc);
Part IV:
Applying Java
gbcgridwidth = GridBagConstraintsRELATIVE; gbagsetConstraints(periodLab, gbc); gbcgridwidth = GridBagConstraintsREMAINDER; gbagsetConstraints(periodText, gbc); gbcgridwidth = GridBagConstraintsRELATIVE; gbagsetConstraints(rateLab, gbc); gbcgridwidth = GridBagConstraintsREMAINDER; gbagsetConstraints(rateText, gbc); gbcgridwidth = GridBagConstraintsRELATIVE; gbagsetConstraints(numWDLab, gbc); gbcgridwidth = GridBagConstraintsREMAINDER; gbagsetConstraints(numWDText, gbc); gbcgridwidth = GridBagConstraintsRELATIVE; gbagsetConstraints(maxWDLab, gbc); gbcgridwidth = GridBagConstraintsREMAINDER; gbagsetConstraints(maxWDText, gbc); gbcanchor = GridBagConstraintsCENTER; gbagsetConstraints(doIt, gbc); // Add all the components add(heading); add(orgPLab); add(orgPText); add(periodLab); add(periodText); add(rateLab); add(rateText); add(numWDLab); add(numWDText); add(maxWDLab); add(maxWDText); add(doIt); // Register to receive action events orgPTextaddActionListener(this); periodTextaddActionListener(this); rateTextaddActionListener(this); numWDTextaddActionListener(this); doItaddActionListener(this); // Create a number format nf = NumberFormatgetInstance(); nfsetMinimumFractionDigits(2); nfsetMaximumFractionDigits(2); } /* User pressed Enter on a text field or pressed Compute Display the result if all fields are completed */ public void actionPerformed(ActionEvent ae) { double result = 00;
32:
Financial Applets and Servlets
String String String String
orgPStr = orgPTextgetText(); periodStr = periodTextgetText(); rateStr = rateTextgetText(); numWDStr = numWDTextgetText();
try { if(orgPStrlength() != 0 && periodStrlength() != 0 && rateStrlength() != 0 && numWDStrlength() != 0) { principal = DoubleparseDouble(orgPStr); numYears = DoubleparseDouble(periodStr); rateOfRet = DoubleparseDouble(rateStr) / 100; numPerYear = IntegerparseInt(numWDStr); result = compute(); maxWDTextsetText(nfformat(result)); } showStatus(""); // erase any previous error message } catch (NumberFormatException exc) { showStatus("Invalid Data"); maxWDTextsetText(""); } } // Compute the maximum regular withdrawals double compute() { double b, e; double t1, t2; t1 = rateOfRet / numPerYear; b = (1 + t1); e = numPerYear * numYears; t2 = Mathpow(b, e) - 1; return principal * (t1/t2 + t1); } }
Copyright © OnBarcode.com . All rights reserved.