Interest calculator (Task 3 on the ninth week ).

Source: Internet
Author: User
/** Copyright (c) 2011, School of Computer Science, Yantai University * All Rights Reserved. * file name: test. CPP * Author: Fan Lulu * Completion Date: July 15, October 25, 2012 * version No.: V1.0 ** input Description: none * Problem description: Enter the deposit amount and select the deposit type, calculate Interest * program output: interest and Interest * Problem Analysis: slightly * Algorithm Design: slightly */# include <iostream> using namespace STD; int main () {double lx, je, CQ, BX; int t; cout <"==== deposit term ====" <Endl; cout <"1. demand deposits "<Endl; cout <" 2. 3 months "<Endl; cout <" 3. 6 months "<Endl; cout <" 4. one year "<Endl; cout <" 5. two years "<Endl; Cout <"6. three years "<Endl; cout <" 7. five Years "<Endl; cout <" Enter the deposit code (1-7): "; CIN> T; If (T> = 8) cout <"Incorrect deposit type selection! Please reselect. "; else {cout <" Enter the deposit amount (RMB): "; CIN> je; If (t = 1) {cout <"Enter the deposit period CQ (days):"; CIN> CQ;} switch (t) {Case 1: lx = je * 0.005 * CQ/360; BX = je + lx; break; Case 2: Lx = je * 0.031*3/12; BX = je + lx; break; Case 3: lx = je * 0.033*6/12; BX = je + lx; break; Case 4: Lx = je * 0.035*1; BX = je + lx; break; Case 5: lx = je * 0.044*2; BX = je + lx; break; Case 6: Lx = je * 0.050*3; BX = je + lx; break; Case 7: lx = je * 0.055*5; BX = je + lx; break;} cout <"Expiration interest:" <lx <"RMB, total principal and interest: "<BX <" Yuan. "<Endl; cout <" Thank you for your use. Welcome to the next time. ";} Return 0 ;}

 

 

Experience: there are indeed many obstacles to doing this, but they have been solved. Haha.

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.