I get two errors
void DisplayProjecte dValue(double amount, int years)
{
Random __gc * r = new Random();
int randomRate = r->Next(0, 20);
DisplayProjecte dValue(amount, years, randomRate);
}
void DisplayProjecte dValue(double amount, int years, double rate)
{
double rateFraction = 1 + (rate/100);
double finalAmount = amount * Math::Pow(rateF raction, years);
finalAmount = Math::Round(fin alAmount, 2);
Console::WriteL ine(S"--------------------------------------------");
Console::WriteL ine(S"Investmen t Amount: ");
Console::Write( amount);
Console::WriteL ine(S"Growth Rate [%]: ");
Console::Write( rate);
Console::WriteL ine(S"Period [years]: ");
Console::Write( years);
Console::WriteL ine (S"Projected Final value of Investment: ");
Console::Write( finalAmount);
Console::WriteL ine(S"--------------------------------------------");
}
I tried changing the last line of the first function to:
DisplayProjecte dValue(amount, years, randomRate->ToDouble(0)) ;
but that also gave me errors.
This is from a book Visual C++ .Net by Templeman and Olsen (Microsoft
Press).
--
Anil Gupte
void DisplayProjecte dValue(double amount, int years)
{
Random __gc * r = new Random();
int randomRate = r->Next(0, 20);
DisplayProjecte dValue(amount, years, randomRate);
}
void DisplayProjecte dValue(double amount, int years, double rate)
{
double rateFraction = 1 + (rate/100);
double finalAmount = amount * Math::Pow(rateF raction, years);
finalAmount = Math::Round(fin alAmount, 2);
Console::WriteL ine(S"--------------------------------------------");
Console::WriteL ine(S"Investmen t Amount: ");
Console::Write( amount);
Console::WriteL ine(S"Growth Rate [%]: ");
Console::Write( rate);
Console::WriteL ine(S"Period [years]: ");
Console::Write( years);
Console::WriteL ine (S"Projected Final value of Investment: ");
Console::Write( finalAmount);
Console::WriteL ine(S"--------------------------------------------");
}
I tried changing the last line of the first function to:
DisplayProjecte dValue(amount, years, randomRate->ToDouble(0)) ;
but that also gave me errors.
This is from a book Visual C++ .Net by Templeman and Olsen (Microsoft
Press).
--
Anil Gupte
Comment