Click here to Skip to main content
15,905,776 members
Home / Discussions / C#
   

C#

 
GeneralRe: Exit a WinForm application at initialization Pin
Stefan Troschuetz27-Jan-07 0:17
Stefan Troschuetz27-Jan-07 0:17 
GeneralRe: Exit a WinForm application at initialization Pin
Glen Harvy27-Jan-07 0:55
Glen Harvy27-Jan-07 0:55 
GeneralRe: Exit a WinForm application at initialization Pin
Stefan Troschuetz27-Jan-07 1:06
Stefan Troschuetz27-Jan-07 1:06 
Questionfaq Pin
Ashutosh Kumar Gupta26-Jan-07 17:10
Ashutosh Kumar Gupta26-Jan-07 17:10 
AnswerRe: faq Pin
quiteSmart26-Jan-07 20:01
quiteSmart26-Jan-07 20:01 
AnswerRe: faq Pin
Syed Muhammad Kamran26-Jan-07 21:25
Syed Muhammad Kamran26-Jan-07 21:25 
AnswerRe: faq Pin
Christian Graus26-Jan-07 21:39
protectorChristian Graus26-Jan-07 21:39 
QuestionNeed help with loan interest calculation Pin
apricotsun26-Jan-07 16:12
apricotsun26-Jan-07 16:12 
Hi! I am new to C# programming and have run into a roadblock. I don't know how to get it to count the number of months needed to pay off the loan. Here is what I have so far:

//declare variables
double loanAmount;
double interestRate;
double monthlyPayment;
double balance;
double monthlyPrincipalPayment;
int monthCounter;
double totalInterestPaid;


//initialize variables
loanAmount = 0;
interestRate = 0;
monthlyPayment = 0;
balance = 0;
monthlyPrincipalPayment = 0;
monthCounter = 0;
totalInterestPaid = 0;


//input statements
Console.WriteLine("Enter loan amount: ", loanAmount);
loanAmount = Convert.ToDouble(Console.ReadLine());

Console.WriteLine("Enter monthly interest rate in decimal format: ", interestRate);
interestRate = Convert.ToDouble(Console.ReadLine());

Console.WriteLine("Enter monthly payment: ", monthlyPayment);
monthlyPayment = Convert.ToDouble(Console.ReadLine());

//calculate monthly principal payment
monthlyPrincipalPayment = balance - (interestRate * loanAmount);

//calculate the total interest paid
totalInterestPaid = totalInterestPaid + (loanAmount * interestRate);

//calculate the total number of months to pay off interest


//while loop
while (balance > 0)
{
//count the number of months
monthCounter++;

//calculate balance each month
balance = balance - monthlyPayment;
}

//display the total interest paid
Console.WriteLine("You paid $ " + totalInterestPaid + " in interest");

//display the total number of months it took to pay loan
Console.WriteLine("It took " + monthCounter + " months to pay off your loan.");



AnswerRe: Need help with loan interest calculation Pin
Glen Harvy26-Jan-07 18:11
Glen Harvy26-Jan-07 18:11 
GeneralRe: Need help with loan interest calculation Pin
apricotsun27-Jan-07 2:55
apricotsun27-Jan-07 2:55 
QuestionRun client-side web scripts in-memory? Pin
Jasmine250126-Jan-07 13:58
Jasmine250126-Jan-07 13:58 
Question.Net Reactor Pin
Glen Harvy26-Jan-07 13:52
Glen Harvy26-Jan-07 13:52 
QuestionMake a wrapped win32-dialog modal Pin
AlexZieg7126-Jan-07 12:45
AlexZieg7126-Jan-07 12:45 
AnswerRe: Make a wrapped win32-dialog modal Pin
Christian Graus26-Jan-07 13:23
protectorChristian Graus26-Jan-07 13:23 
GeneralRe: Make a wrapped win32-dialog modal Pin
AlexZieg7126-Jan-07 22:47
AlexZieg7126-Jan-07 22:47 
AnswerRe: Make a wrapped win32-dialog modal Pin
AlexZieg7127-Jan-07 3:37
AlexZieg7127-Jan-07 3:37 
QuestionFinding word in textbox Pin
conemajstor26-Jan-07 10:26
conemajstor26-Jan-07 10:26 
AnswerRe: Finding word in textbox Pin
Christian Graus26-Jan-07 10:33
protectorChristian Graus26-Jan-07 10:33 
GeneralRe: Finding word in textbox Pin
conemajstor26-Jan-07 10:35
conemajstor26-Jan-07 10:35 
GeneralRe: Finding word in textbox Pin
Christian Graus26-Jan-07 10:40
protectorChristian Graus26-Jan-07 10:40 
AnswerRe: Finding word in textbox Pin
engsrini27-Jan-07 22:39
engsrini27-Jan-07 22:39 
QuestionFiling Combobox with alphabet Pin
conemajstor26-Jan-07 8:34
conemajstor26-Jan-07 8:34 
GeneralRe: Filing Combobox with alphabet Pin
MoustafaS26-Jan-07 8:41
MoustafaS26-Jan-07 8:41 
GeneralRe: Filing Combobox with alphabet Pin
conemajstor26-Jan-07 8:45
conemajstor26-Jan-07 8:45 
GeneralRe: Filing Combobox with alphabet Pin
ednrgc26-Jan-07 9:16
ednrgc26-Jan-07 9:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.