Calculation of investment income credit help

2010-12-14  来源:本站原创  分类:Java  人气:84 

http://www.daybang.com

package test;

import java.util.Vector;

public class DayBang {

        public static void t01()
        {
                int tzsj = 0;
                //TouZi rootTz = new TouZi(10, tzsj);
                //TouZi rootTz = new TouZi(127.92f, tzsj);
                //TouZi rootTz = new TouZi(12792, tzsj);
                TouZi rootTz = new TouZi(20000, tzsj);

                System.out.println( " All amounts in minutes, round " );
                System.out.println( " Match period, "+ rootTz.chq + months , After that, the investment , Need extension "+ rootTz.chq + months in order to receive benefits " );
                System.out.println( " Return period, "+ rootTz.hbq + months , After that, the investment , "+ RootTz.hbq +" months return " );
                System.out.println( " A handling rate :" + rootTz.souXu  );
                System.out.println( " Nominal interest rate :" + (rootTz.souXu + rootTz.shouYi )  );
                System.out.println( " Rate of return :" + rootTz.shouYi ); 

                System.out.println( " The principal :" + rootTz.tzze );
                Vector<TouZi>  vec = new Vector<TouZi>();
                vec.add(rootTz);

                System.out.println( "==============================" );

                for(int i=0; i<120; i++)
                {
                        System.out.println( " Month :" + i );
                        int zsr = 0; // Total revenue
                        for(int j = vec.size()-1; j>=0; j-- )
                        {
                                TouZi tmp = vec.elementAt(j);

                                if(tmp.srjs<i)
                                {
                                        vec.remove(j);
                                        continue;
                                }
                        }

                        for(int j = 0; j<vec.size(); j++ )
                        {
                                TouZi tmp = vec.elementAt(j);

                                if(tmp.srks<=i && tmp.srjs>=i)
                                {
                                        zsr += tmp.shouRu;
                                        System.out.println( " Investment of time : " +  tmp.tzsj + " \t Investment :" +  tmp.tzze + " \t Principal :" +  tmp.benJin + " \t Income :" +  tmp.shouRu );
                                        //System.out.println( "tzsj: " +  tmp.tzsj + " \ttzze:" +  tmp.tzze + " \tbj:" +  tmp.benJin + " \tsr:" +  tmp.shouRu );
                                }
                        }

                        if(zsr>0)
                        {
                                TouZi newTz = new TouZi(zsr, i);
                                vec.add(newTz);
                        }

                        System.out.println( " Total revenue :" + zsr );
                        //System.out.println( "zsr:" + zsr );
                        System.out.println( "==============================" );
                }

                System.out.println( " All amounts in minutes, round " );
                System.out.println( " Match period, "+ rootTz.chq + months , After that, the investment , Need extension "+ rootTz.chq + months in order to receive benefits " );
                System.out.println( " Return period, "+ rootTz.hbq + months , After that, the investment , "+ RootTz.hbq +" months return " );
                System.out.println( " A handling rate :" + rootTz.souXu  );
                System.out.println( " Nominal interest rate :" + (rootTz.souXu + rootTz.shouYi )  );
                System.out.println( " Rate of return :" + rootTz.shouYi ); 

        }

        /**
         * @param args
         */
        public static void main(String[] args) {
                t01();
        }

}
package test;

/**
 *  All amounts in minutes, round
 *  Match period, the default for a month , After that, the investment , Need extension of one month in order to receive benefits
 *  Return period, the default for 12 months , After that, the investment , Divided into 12 months back
 *  A handling rate : Default  6.6%
 *  Nominal interest rate : Default  12%
 *  Rate of return :12%-6.6%=5.4%
 *
 * @author Administrator
 *
 */

public class TouZi {
        public int benJin = 0;        // Monthly return of principal
        public float souXu = 0.066f;  // A handling rate
        public int hbq = 12;          // Return period, the default for 12 months , After that, the investment , Divided into 12 months back
        public int tzze = 0;          // Total investment 

        public float shouYi = 0.09f;  // Rate of return
        //public float shouYi = 0.09f;  // Rate of return
        //public float mysr = 0;      // Nominal income
        public int shouRu = 0;        // Actual income 

        public int tzsj = 0;           // Investment of time
        public int chq = 1;            // Match period, the default for a month , After that, the investment , Need extension of one month in order to receive benefits
        //public int chq = 0;          // Match period, the default for a month , After that, the investment , Need extension of one month in order to receive benefits
        public int srks = 2;           // Income start time
        public int srjs   = 13;        // Income end time 

        public TouZi(int tzze, int tzsj)
        {
                this.tzze = tzze;
                benJin =  (int)(tzze / (hbq * (1 + souXu )));
                shouRu = (int)(benJin * (1 + souXu + shouYi )); 

                this.tzsj = tzsj;
                srks = tzsj + 1 + chq;
                srjs = tzsj + chq + hbq;
        }

}

All the amount is divided into units, rounded to match the period of 1 month, ie, capital investment, the need for extension of 1 month to get the income return period of 12 months, that is, capital investment, the sub-commission rate of return of 12 months : 0.066
Nominal interest rate: 0.156
Yield: 0.09
Principal cast: 20,000
==============================
Month: 0
Total Revenue: 0
==============================
Month: 1
Total Revenue: 0
==============================
Month: 2
Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806
Total Revenue: 1806
==============================
Month: 3
Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806
Total Revenue: 1806
==============================
Month: 4
Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806
Investment: 2 Investment: 1806 Principal: 141 Income: 162
Total Revenue: 1968
==============================
Month: 5
Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806
Investment: 2 Investment: 1806 Principal: 141 Income: 162
Investment of time: 3 Investment: 1806 Principal: 141 Income: 162
Total Revenue: 2130
==============================
Month: 6
Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806
Investment: 2 Investment: 1806 Principal: 141 Income: 162
Investment of time: 3 Investment: 1806 Principal: 141 Income: 162
Investment Time: 4 Investment: 1968 Principal: 153 Income: 176
Total Revenue: 2306
==============================
Month: 7
Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806
Investment: 2 Investment: 1806 Principal: 141 Income: 162
Investment of time: 3 Investment: 1806 Principal: 141 Income: 162
Investment Time: 4 Investment: 1968 Principal: 153 Income: 176
Investment: 5 Investment: 2130 Principal: 166 Income: 191
Total Revenue: 2497
==============================
Month: 8
Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806
Investment: 2 Investment: 1806 Principal: 141 Income: 162
Investment of time: 3 Investment: 1806 Principal: 141 Income: 162
Investment Time: 4 Investment: 1968 Principal: 153 Income: 176
Investment: 5 Investment: 2130 Principal: 166 Income: 191
Investment: 6 investment: 2306 Principal: 180 Income: 208
Total Revenue: 2705
==============================
Month: 9
Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806
Investment: 2 Investment: 1806 Principal: 141 Income: 162
Investment of time: 3 Investment: 1806 Principal: 141 Income: 162
Investment Time: 4 Investment: 1968 Principal: 153 Income: 176
Investment: 5 Investment: 2130 Principal: 166 Income: 191
Investment: 6 investment: 2306 Principal: 180 Income: 208
Investment: 7 Investment: 2497 Principal: 195 Income: 225
Total Revenue: 2930
==============================
Month: 10
Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806
Investment: 2 Investment: 1806 Principal: 141 Income: 162
Investment of time: 3 Investment: 1806 Principal: 141 Income: 162
Investment Time: 4 Investment: 1968 Principal: 153 Income: 176
Investment: 5 Investment: 2130 Principal: 166 Income: 191
Investment: 6 investment: 2306 Principal: 180 Income: 208
Investment: 7 Investment: 2497 Principal: 195 Income: 225
Investment Time: 8 Investment: 2705 Principal: 211 Income: 243
Total Revenue: 3173
==============================
Month: 11
Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806
Investment: 2 Investment: 1806 Principal: 141 Income: 162
Investment of time: 3 Investment: 1806 Principal: 141 Income: 162
Investment Time: 4 Investment: 1968 Principal: 153 Income: 176
Investment: 5 Investment: 2130 Principal: 166 Income: 191
Investment: 6 investment: 2306 Principal: 180 Income: 208
Investment: 7 Investment: 2497 Principal: 195 Income: 225
Investment Time: 8 Investment: 2705 Principal: 211 Income: 243
Investment Time: 9 Investment: 2930 Principal: 229 Income: 264
Total Revenue: 3437
==============================
Month: 12
Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806
Investment: 2 Investment: 1806 Principal: 141 Income: 162
Investment of time: 3 Investment: 1806 Principal: 141 Income: 162
Investment Time: 4 Investment: 1968 Principal: 153 Income: 176
Investment: 5 Investment: 2130 Principal: 166 Income: 191
Investment: 6 investment: 2306 Principal: 180 Income: 208
Investment: 7 Investment: 2497 Principal: 195 Income: 225
Investment Time: 8 Investment: 2705 Principal: 211 Income: 243
Investment Time: 9 Investment: 2930 Principal: 229 Income: 264
Investment: 10 Investment: 3173 Principal: 248 Income: 286
Total Revenue: 3723
==============================
Month: 13
Investment of time: 0 Investment: 20000 Principal: 1563 Revenue: 1806
Investment: 2 Investment: 1806 Principal: 141 Income: 162
Investment of time: 3 Investment: 1806 Principal: 141 Income: 162
Investment Time: 4 Investment: 1968 Principal: 153 Income: 176
Investment: 5 Investment: 2130 Principal: 166 Income: 191
Investment: 6 investment: 2306 Principal: 180 Income: 208
Investment: 7 Investment: 2497 Principal: 195 Income: 225
Investment Time: 8 Investment: 2705 Principal: 211 Income: 243
Investment Time: 9 Investment: 2930 Principal: 229 Income: 264
Investment: 10 Investment: 3173 Principal: 248 Income: 286
Investment: 11 Investment: 3437 Principal: 268 Income: 309
Total Revenue: 4032
==============================
Month: 14
Investment: 2 Investment: 1806 Principal: 141 Income: 162
Investment of time: 3 Investment: 1806 Principal: 141 Income: 162
Investment Time: 4 Investment: 1968 Principal: 153 Income: 176
Investment: 5 Investment: 2130 Principal: 166 Income: 191
Investment: 6 investment: 2306 Principal: 180 Income: 208
Investment: 7 Investment: 2497 Principal: 195 Income: 225
Investment Time: 8 Investment: 2705 Principal: 211 Income: 243
Investment Time: 9 Investment: 2930 Principal: 229 Income: 264
Investment: 10 Investment: 3173 Principal: 248 Income: 286
Investment: 11 Investment: 3437 Principal: 268 Income: 309
Investment Time: 12 Investment: 3723 Principal: 291 Income: 336
Total Revenue: 2562
==============================
Month: 15
Investment: 2 Investment: 1806 Principal: 141 Income: 162
Investment of time: 3 Investment: 1806 Principal: 141 Income: 162
Investment Time: 4 Investment: 1968 Principal: 153 Income: 176
Investment: 5 Investment: 2130 Principal: 166 Income: 191
Investment: 6 investment: 2306 Principal: 180 Income: 208
Investment: 7 Investment: 2497 Principal: 195 Income: 225
Investment Time: 8 Investment: 2705 Principal: 211 Income: 243
Investment Time: 9 Investment: 2930 Principal: 229 Income: 264
Investment: 10 Investment: 3173 Principal: 248 Income: 286
Investment: 11 Investment: 3437 Principal: 268 Income: 309
Investment Time: 12 Investment: 3723 Principal: 291 Income: 336
Investment Time: 13 Investment: 4032 Principal: 315 Income: 364
Total Revenue: 2926

相关文章
  • Calculation of investment income credit help 2010-12-14

    http://www.daybang.com package test; import java.util.Vector; public class DayBang { public static void t01() { int tzsj = 0; //TouZi rootTz = new TouZi(10, tzsj); //TouZi rootTz = new TouZi(127.92f, tzsj); //TouZi rootTz = new TouZi(12792, tzsj); To

  • Investment rate of return on real estate look at the annual rent not buy a house less than 3% 2010-06-23

    In Shenzhen, people to meet long greeting greeting is not "eat it?" But "buy a house yet?" Visible Shenzhen Investment buy a house in vogue. Over the years, the Shenzhen property market came too many rich mythology, more and more peopl

  • Interest soared several times to put it differently teach you good enough for a lifetime of saving law 2010-10-11

    Abstract of this year the stock market downturn, a lot of money from the stock market to banks, many became current savings. The central bank cut interest rates four times this year, the call rate has dropped to 0.36%, did not save some money last ye

  • Financial accounts and major accounts business process 2011-07-22

    Financial accounts and major accounts business process 1003 balances with central banks First, the subject accounting companies (banks) exist in the People's Bank of China (hereinafter referred to as the "Central Bank") all amounts, including th

  • The era of high returns over the past 2010-06-23

    The era of high returns over the past To say that return on investment is high, when the number of property speculation, short-term speculative real estate, Kuaijinkuaichu, also known as Bo Short. Short-term return on investment calculation is relati

  • Survey of Insurance Information 2010-10-08

    Overview of the insurance company system construction Construction of the insurance status of the company integrated business system Integrated business system is the insurance company's core systems can be divided into property and casualty insuranc

  • Great wisdom of financial data formats 2010-12-09

    Apply to "a new generation of great wisdom, Level-2 V3.03.08.0801" version. Appendix: Data Table Structure ◎ code data (cndm) type of structure field names meaning Remarks code char dm jc referred to as the char ◎ market data (cnfqhq) type of st

  • Participating insurance Profile 2010-12-20

    First, dividends and bonuses from the insurance concept of the so-called participating insurance, insurance company refers to the end of each fiscal year, the previous fiscal year, the insurance of such dividends distributable surplus, according to a

  • Depreciation of fixed assets and depreciation method of 2011-05-26

    Participate in long-term fixed assets, production and management while maintaining its original physical form, but its value is used with the fixed assets gradually transferred to the product cost, operating costs of an enterprise, this part of the w

  • Commercial Bank of China business segment (switch) 2011-03-28

    Statement : This article is reproduced from http://blog.sina.com.cn/s/blog_5173230b0100etxg.html Take a look at what banks have done, that is their business segments . The most common classification is : Debt service ( Commercial bank financing of bu

  • jasperReport dynamic column Print 2010-03-23

    public ActionResult projectPrint() { String[] printValue = null; // From the page fields to the query String reqPrintValue = getRequest().getParameter("printValue"); // Do not select the default all-print if (null == reqPrintValue || StringUtils

  • Tragic history of my project requirements change frequently 2010-03-10

    A while ago, I served as project manager to undertake a medium-sized software project, the company Zaisandingning I have to respect the customer, to fully meet customer needs. Beginning of the project smoothly, hard boil a few months of night, keepin

  • oracle study notes 15 - PLSQL2 2010-03-06

    Bags for the logical combination of process and function, which by the package specification and the inclusion of two parts. We can create package command to create the package create package morf_package is procedure update_sal(name varchar2,newSal

  • Textile digital inkjet printing technology, new developments 2010-02-18

    Keywords: textile, digital, inkjet printing, technology, development of digital printing technology to print images input through the computer in digital form, through editing, then computer-controlled nozzles to direct spray to the textile dye, the

  • 18. Define and use variables, complex type 2010-05-11

     define and use the variables introduced in the preparation of pl / sql procedure, you can define variables and constants; in pl / sql procedures include: 1. Scalar types (scalar) 2. Composite type (composite) 3. Reference types (reference) 4.lob (l

  • Oracle ERP system and the monthly flow of year-end 2010-05-28

    Monthly and year-end processing, is rather special and important corporate finance business operations. Zai Oracle ERP system implementation and promotion of the process, how to combine the current accounting system and practice, Chongfenliyong softw

  • Python generator and yield 2010-09-11

    generator generator: a Python generator is a kind of Python iterator [1], but of an especially powerful kind. yield production: can be interpreted as "return and wait." Know all the yield statement is completed, then if another call next (), the

  • Three departments work together to promote the development of the insurance information while facing four major problems 2010-09-18

    Information standardization as technical constraints Information on the process of standardization of information has always been the biggest technical constraint. Government in the development of the insurance industry standardization system is also

  • Three departments work together to promote the development of both insurance information problems faced by the four 2010-09-18

    Standardization of information as technical constraints Information standardization process of information has always been the biggest technical constraints. Government standardization system in the development of the insurance industry is also spare

  • Oracle PL / SQL using variable summary 2010-11-12

    There are four types PLSQL variables are: - Scalar (Scalar) - Complex type (Composite) - Reference type (Reference) - LOB type (Large Object) 1, scalar types: - Can only store a single value of the variable - definition, must specify the data type of