Interest rate calculation v5.0--pair--software engineering

Source: Internet
Author: User

Interest rate calculation V5. 0--testing--software engineering

1. Task Pair Companion: Name: Wang Xinming:201406114217 Blog address: http://home.cnblogs.com/u /xinmingwang/Git:https://github.com/shunc/interestratecalculation
that is, to pursue benefits, but also to face unpredictable financial investment risks, "can not put eggs in the same basket", it is necessary to make a portfolio investment. The above calculations and comparisons can help customers make investment decisions. Customer: So can you help me to record a different type of investment, and dynamically show the current value of money?  2. Development tools: IntelliJ idea 15.0.4, MySQL development language: Java-Web main functions: Compound interest calculation, simple interest calculation because the computational framework has not come and made, So the function can only be implemented in the form of simple interface.  3, Division: Cai Sun: Design of the overall framework, code writing Wang Xinming: access to relevant information, collaborative inspection code

The use of Hibernate framework to achieve Data Link summary: Due to time problems, write the test class, the specific page is not ready.    the next pair will implement specific functions.

Test the asset of the user name (surname Zhang)

@Test Public voidTestcatipal () {Session session=NULL; Try {            //Get SessionSession =hibernatefactory.opensession (); List<User> users = Session.createquery ("Select User from user user left join User.assets asset where user.name like '% sheet% '"). Setfirstresult (0). Setmaxresults ( the). List ();  for(User user:users) { for(Asset asset:user.getAssets ()) {System. out. println (User.getname () +" "+ Asset.getcatipal () +" "+ asset.gettype () +" "+asset.getnowdate ()); }            }        }Catch(Exception e) {e.printstacktrace (); //Business Rollback            if(Session! =NULL) session.gettransaction (). rollback (); }finally {            //End of BusinessHibernatefactory.close (session); }    }

Test adding users and assets

@Test Public voidTestaddasset () {Session session=NULL; Try {            //Get SessionSession =hibernatefactory.opensession (); //Start Business Processingsession.begintransaction (); /** Add User 500 * Add per user asset information 0 ~ 30 **/             for(inti =0; I < -; i++) {User User=NewUser (GetUserName (), GetPassword (), GetName ());                Session.save (user);  for(intj =0; J < Ran.nextint ( -) ; J + +) {Asset Asset=NewAsset (User, Getcatipal (), GetType (),NewDate ());                Session.save (asset); }            }            //Business Submissionsession.gettransaction (). commit (); }Catch(Exception e) {e.printstacktrace (); //Business Rollback            if(Session! =NULL) session.gettransaction (). rollback (); }finally {            //End of BusinessHibernatefactory.close (session); }    }

Database User Table

Database Asset Table

Interest rate calculation v5.0--pair--software engineering

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.