java barcode api Finding the Initial Investment Required to Achieve a Future Value in Java

Creation Denso QR Bar Code in Java Finding the Initial Investment Required to Achieve a Future Value

Finding the Initial Investment Required to Achieve a Future Value
QR Code Maker In Java
Using Barcode generator for Java Control to generate, create Quick Response Code image in Java applications.
QR Code JIS X 0510 Decoder In Java
Using Barcode decoder for Java Control to read, scan read, scan image in Java applications.
Sometimes you will want to know how large an initial investment is required to achieve some future value For example, if you are saving for your child s college education and you know that you will need $75,000 in five years, how much money do you need to invest at 7 percent to reach that goal The InitInv applet developed here can answer that question
Barcode Printer In Java
Using Barcode creation for Java Control to generate, create barcode image in Java applications.
Scanning Barcode In Java
Using Barcode decoder for Java Control to read, scan read, scan image in Java applications.
Part IV:
QR Generator In Visual C#.NET
Using Barcode maker for .NET Control to generate, create QR Code JIS X 0510 image in VS .NET applications.
Making QR Code ISO/IEC18004 In .NET
Using Barcode printer for ASP.NET Control to generate, create Quick Response Code image in ASP.NET applications.
Applying Java
Encode QR-Code In Visual Studio .NET
Using Barcode generation for VS .NET Control to generate, create QR image in Visual Studio .NET applications.
Generating QR-Code In Visual Basic .NET
Using Barcode creation for Visual Studio .NET Control to generate, create QR Code 2d barcode image in VS .NET applications.
FIGURE 32-3
Data Matrix ECC200 Generator In Java
Using Barcode generator for Java Control to generate, create ECC200 image in Java applications.
Printing GS1 DataBar Stacked In Java
Using Barcode encoder for Java Control to generate, create GS1 DataBar Limited image in Java applications.
The InitInv applet
Code 3 Of 9 Drawer In Java
Using Barcode generator for Java Control to generate, create Code-39 image in Java applications.
Encoding ECC200 In Java
Using Barcode creation for Java Control to generate, create Data Matrix image in Java applications.
The formula to compute an initial investment is shown here: Initial Investment = targetValue / (((rateOfRet / compPerYear) + 1) compPerYear * numYears) where rateOfRet specifies the rate of return, targetValue contains the starting balance, compPerYear specifies the number of compounding periods per year, and numYears specifies the length of the investment in years If you use an annualized rate of return for rateOfRet, then the number of compounding periods is 1 The following applet called InitInv uses the preceding formula to compute the initial investment required to reach a desired future value The applet produced by this program is shown in Figure 32-3
Leitcode Creation In Java
Using Barcode printer for Java Control to generate, create Leitcode image in Java applications.
UPC-A Scanner In Visual C#
Using Barcode reader for .NET Control to read, scan read, scan image in .NET applications.
/* Compute the initial investment necessary for a specified future value */ import javaawt*; import javaawtevent*; import javaxswing*; import javatext*; /* <applet code="InitInv" width=340 height=240> </applet> */ public class InitInv extends JApplet implements ActionListener { JTextField targetText, initialText, periodText, rateText, compText; JButton doIt; double targetValue; double rateOfRet; double numYears; int compPerYear; NumberFormat nf; // // // // original targetValue rate of return length of loan in years number of compoundings per year
Code 3 Of 9 Scanner In None
Using Barcode decoder for Software Control to read, scan read, scan image in Software applications.
Read Bar Code In None
Using Barcode reader for Software Control to read, scan read, scan image in Software applications.
32:
Making Code 128 Code Set B In Java
Using Barcode drawer for Android Control to generate, create ANSI/AIM Code 128 image in Android applications.
Print Code39 In Visual Studio .NET
Using Barcode generator for Visual Studio .NET Control to generate, create Code 39 Full ASCII image in Visual Studio .NET applications.
Financial Applets and Servlets
Drawing Data Matrix ECC200 In None
Using Barcode creation for Software Control to generate, create ECC200 image in Software applications.
Data Matrix 2d Barcode Scanner In Java
Using Barcode reader for Java Control to read, scan read, scan image in Java 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("Initial Investment Needed for " + "Future Value"); JLabel JLabel JLabel JLabel targetLab = new JLabel("Desired Future Value "); periodLab = new JLabel("Years "); rateLab = new JLabel("Rate of Return "); compLab = new JLabel("Compounding Periods per Year "); JLabel initialLab = new JLabel("Initial Investment Required "); targetText = new JTextField(10); periodText = new JTextField(10); initialText = new JTextField(10); rateText = new JTextField(10); compText = new JTextField(10); // Initial value field for display only initialTextsetEditable(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;
Part IV:
Applying Java
gbagsetConstraints(targetLab, gbc); gbcgridwidth = GridBagConstraintsREMAINDER; gbagsetConstraints(targetText, gbc); gbcgridwidth = GridBagConstraintsRELATIVE; gbagsetConstraints(periodLab, gbc); gbcgridwidth = GridBagConstraintsREMAINDER; gbagsetConstraints(periodText, gbc); gbcgridwidth = GridBagConstraintsRELATIVE; gbagsetConstraints(rateLab, gbc); gbcgridwidth = GridBagConstraintsREMAINDER; gbagsetConstraints(rateText, gbc); gbcgridwidth = GridBagConstraintsRELATIVE; gbagsetConstraints(compLab, gbc); gbcgridwidth = GridBagConstraintsREMAINDER; gbagsetConstraints(compText, gbc); gbcgridwidth = GridBagConstraintsRELATIVE; gbagsetConstraints(initialLab, gbc); gbcgridwidth = GridBagConstraintsREMAINDER; gbagsetConstraints(initialText, gbc); gbcanchor = GridBagConstraintsCENTER; gbagsetConstraints(doIt, gbc); // Add all the components add(heading); add(targetLab); add(targetText); add(periodLab); add(periodText); add(rateLab); add(rateText); add(compLab); add(compText); add(initialLab); add(initialText); add(doIt); // Register to receive action events targetTextaddActionListener(this); periodTextaddActionListener(this); rateTextaddActionListener(this); compTextaddActionListener(this); doItaddActionListener(this); // Create a number format nf = NumberFormatgetInstance(); nfsetMinimumFractionDigits(2); nfsetMaximumFractionDigits(2); } /* User pressed Enter on a text field
32:
Financial Applets and Servlets
or pressed Compute Display the result if all fields are completed */ public void actionPerformed(ActionEvent ae) { double result = 00; String String String String targetStr periodStr rateStr = compStr = = targetTextgetText(); = periodTextgetText(); rateTextgetText(); compTextgetText();
try { if(targetStrlength() != 0 && periodStrlength() != 0 && rateStrlength() != 0 && compStrlength() != 0) { targetValue = DoubleparseDouble(targetStr); numYears = DoubleparseDouble(periodStr); rateOfRet = DoubleparseDouble(rateStr) / 100; compPerYear = IntegerparseInt(compStr); result = compute(); initialTextsetText(nfformat(result)); } showStatus(""); // erase any previous error message } catch (NumberFormatException exc) { showStatus("Invalid Data"); initialTextsetText(""); } } // Compute the required initial investment double compute() { double b, e; b = (1 + rateOfRet/compPerYear); e = compPerYear * numYears; return targetValue / Mathpow(b, e); } }
Copyright © OnBarcode.com . All rights reserved.