Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to stop an Event Pin
Dave Kreskowiak13-May-09 10:47
mveDave Kreskowiak13-May-09 10:47 
GeneralRe: How to stop an Event Pin
PIEBALDconsult13-May-09 14:59
mvePIEBALDconsult13-May-09 14:59 
GeneralRe: How to stop an Event Pin
Luc Pattyn13-May-09 15:39
sitebuilderLuc Pattyn13-May-09 15:39 
GeneralRe: How to stop an Event Pin
Dave Kreskowiak13-May-09 19:12
mveDave Kreskowiak13-May-09 19:12 
GeneralRe: How to stop an Event Pin
Payam Rastogi14-May-09 11:05
Payam Rastogi14-May-09 11:05 
GeneralRe: How to stop an Event Pin
Dave Kreskowiak14-May-09 17:54
mveDave Kreskowiak14-May-09 17:54 
AnswerRe: How to stop an Event Pin
DaveyM6913-May-09 10:51
professionalDaveyM6913-May-09 10:51 
QuestionSimple Interest Problem Pin
ctreed72813-May-09 10:05
ctreed72813-May-09 10:05 
How could I show the total interest paid and the average interest gained each year?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Project1
{
    class Program
    {
        public static void Main()
        {
            Console.Write("Enter principal: ");
            decimal p = Convert.ToDecimal(Console.ReadLine());
            if (p < 0)
            {  
                Console.WriteLine("Principal cannot be negative");
                p = 0;
            }

            Console.Write("Enter interest rate: ");
            decimal i = Convert.ToDecimal(Console.ReadLine());
            if (i < 0)
            {
                Console.WriteLine("Interest cannot be negative");
                i = 0;
            }

            Console.Write("Enter time (in years): ");
            int years = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("\nPrincipal = " + p
               + "\nInterest  = " + i + "%"
               + "\nTime  = " + years + " years\n");


            Console.WriteLine("\n\nYear\tRate\t   Amount\tInterest\tNew Amount");
            Console.WriteLine("===========================================================");
            
            int year = 1;
            
            while (year <= years)
            {
                decimal interestPaid = p * (i / 100);

                decimal amount = p + interestPaid;

                p += interestPaid;

                p = decimal.Round(p, 2);

                interestPaid = decimal.Round(interestPaid, 2);

                amount = decimal.Round(amount, 2);

                Console.WriteLine(year + "\t" + i + "%\t" + ((p - interestPaid).ToString().PadLeft(10)) + "\t" + interestPaid.ToString().PadLeft(8) + "\t" + p.ToString().PadLeft(8));

                year++;
            }
        }
    }
}

AnswerRe: Simple Interest Problem Pin
Luc Pattyn13-May-09 10:12
sitebuilderLuc Pattyn13-May-09 10:12 
AnswerRe: Simple Interest Problem Pin
Christian Graus13-May-09 11:20
protectorChristian Graus13-May-09 11:20 
QuestionForce CG Pin
Jammer13-May-09 9:43
Jammer13-May-09 9:43 
AnswerRe: Force CG Pin
Dave Kreskowiak13-May-09 9:55
mveDave Kreskowiak13-May-09 9:55 
GeneralRe: Force CG Pin
Jammer13-May-09 10:12
Jammer13-May-09 10:12 
GeneralRe: Force CG Pin
Dave Kreskowiak13-May-09 10:44
mveDave Kreskowiak13-May-09 10:44 
GeneralRe: Force CG Pin
Jammer13-May-09 10:49
Jammer13-May-09 10:49 
GeneralRe: Force CG Pin
Christian Graus13-May-09 11:18
protectorChristian Graus13-May-09 11:18 
GeneralRe: Force CG Pin
Dave Kreskowiak13-May-09 14:24
mveDave Kreskowiak13-May-09 14:24 
AnswerRe: Force CG Pin
Christian Graus13-May-09 11:15
protectorChristian Graus13-May-09 11:15 
GeneralRe: Force CG Pin
Jammer13-May-09 11:23
Jammer13-May-09 11:23 
GeneralRe: Force CG Pin
Christian Graus13-May-09 11:25
protectorChristian Graus13-May-09 11:25 
GeneralRe: Force CG Pin
Jammer13-May-09 11:41
Jammer13-May-09 11:41 
Questionhow to retrieve seconds, minutes and hours out of timer Pin
Aljaz11113-May-09 9:39
Aljaz11113-May-09 9:39 
AnswerRe: how to retrieve seconds, minutes and hours out of timer Pin
OriginalGriff13-May-09 9:52
mveOriginalGriff13-May-09 9:52 
QuestionHelp access image from the internet Pin
Alex_xso13-May-09 9:20
Alex_xso13-May-09 9:20 
AnswerRe: Help access image from the internet Pin
Dave Kreskowiak13-May-09 9:38
mveDave Kreskowiak13-May-09 9:38 

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.