1, the written code language is the C language, the first two experimental code lines of about 50. The workload of one person is about 90 minutes.
2, the estimated completion of the 4th, 5 experiments required code line number is about 150, the time spent a person for 90 minutes.
3. The estimated number of lines required to complete the 6th experiment is 100 or so, and the time is 90 minutes for each person.
4, has now completed the first 5 experiments, the actual code line number of 110 rows or so. The total time spent is about 150 minutes. This obviously with the above statistics some gap, hope later according to own situation, make the correct estimate summary.
Source:
#include <stdio.h>
#include <math.h>
void Danli ();
void Fuli ();
void Getprincipal ();
void GetYear ();
void Getyearrate ();
Double p,i,f;
int n;
Main ()
{
int num=0;
while (1) {
printf ("\t\t\t|************ Compounding calculator ************|\n");
printf ("\t\t\t|------------0. Exit calculation------------|\n ");
printf ("\t\t\t|------------1. Simple interest----------------|\n");
printf ("\t\t\t|------------2. Compounding----------------|\n");
printf ("\t\t\t|------------3. Calculate principal------------|\n");
printf ("\t\t\t|------------4. Estimated------------|\n");
printf ("\t\t\t|------------5. Estimated annual rate of return--------|\n");
printf ("\t\t\t|----------------------------------|\n");
printf ("Please enter select:");
scanf ("%d", &num);
Switch (num)
{
Case 0:
return 0;
Case 1:
Danli ();
Break
Case 2:
Fuli ();
Break
Case 3:
Getprincipal ();
Break
Case 4:
GetYear ();
Break
Case 5:
Getyearrate ();
Break
Default:
return 0;
}
}
}
void Danli ()
{
printf ("Please enter the Principal:");
scanf ("%lf", &p);
printf ("Please enter annual interest rate (percentage):");
scanf ("%lf", &i);
printf ("Please enter storage life:");
scanf ("%d", &n);
f = p+p* (i/100) *n;
printf ("Simple Interest Final value:%0.2lf\n", f);
}
void Fuli ()
{
printf ("Please enter the Principal:");
scanf ("%lf", &p);
printf ("Please enter annual interest rate (percentage):");
scanf ("%lf", &i);
printf ("Please enter storage life:");
scanf ("%d", &n);
f = p* (Pow (1+i/100,n));
printf ("End value of compounding:%0.2lf\n", f);
}
void Getprincipal ()
{
printf ("Please enter the target amount:");
scanf ("%lf", &f);
printf ("Please enter the target interest rate (percentage):");
scanf ("%lf", &i);
printf ("Please enter the target age:");
scanf ("%d", &n);
p = F/pow (1+ (i/100), n);
printf ("Principal to be invested:%0.2lf\n", p);
}
void GetYear ()
{
printf ("Please enter Benli and:");
scanf ("%lf", &f);
printf ("Please enter annual rate of return (percentage):");
scanf ("%lf", &i);
printf ("Please enter the Principal:");
scanf ("%lf", &p);
for (n=1;; n++)
{
if (p* (Pow ((1+i/100), n)) >=f)
{
printf ("Minimum Life:%d\n\n", N);
Break
}
}
}
void Getyearrate ()
{
printf ("Please enter Benli and:");
scanf ("%lf", &f);
printf ("Please enter the Principal:");
scanf ("%lf", &p);
printf ("Please enter the target age:");
scanf ("%d", &n);
i = POW ((f/p), 1.0/n)-1;
printf ("Annual rate of Return:%0.2lf\n", i);
}
03-17 Compounding Experiment Summary