Ejemplo n.º 1
0
        public void TestMethod1()
        {
            SimpleInterest sitest = new SimpleInterest();
            float          sit    = sitest.getsi(100, 1);

            Assert.AreEqual(sit, 12);
        }
Ejemplo n.º 2
0
        public void Assignment6()
        {
            Console.WriteLine("Assignment 6: Simple interest calculation");
            SimpleInterest interestObj = new SimpleInterest();

            interestObj.SimpleInterestCalculation();
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> PutSimpleInterest(int id, SimpleInterest simpleInterest)
        {
            if (id != simpleInterest.Id)
            {
                return(BadRequest());
            }

            _context.Entry(simpleInterest).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SimpleInterestExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Interest si;

            Console.Write("Enter the priciple: ");
            double principle = double.Parse(Console.ReadLine());

            Console.Write("Enter the rate: ");
            double rate = double.Parse(Console.ReadLine());

            Console.Write("Enter the years: ");
            int years = int.Parse(Console.ReadLine());

            Console.WriteLine("Choose the Option...\n 1.Simple Interest\t2.Coumpound Interst");
            int choice = int.Parse(Console.ReadLine());

            if (choice == 1)
            {
                si = new SimpleInterest();
                si.CalculateInterest(principle, rate, years);
            }
            else if (choice == 2)
            {
                si = new CompoundInterest();
                si.CalculateInterest(principle, rate, years);
            }
            else
            {
                Console.WriteLine("Wrong Choice");
            }
        }
Ejemplo n.º 5
0
 public SimpleInterestLoan(Account account, Loan loan, SimpleInterest si)
 {
     InitializeComponent();
     Account = account;
     Loan    = loan;
     this.si = si;
 }
Ejemplo n.º 6
0
        public async Task <ActionResult <SimpleInterest> > PostSimpleInterest(SimpleInterest simpleInterest)
        {
            _context.SimpleInterests.Add(simpleInterest);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetSimpleInterest", new { id = simpleInterest.Id }, simpleInterest));
        }
Ejemplo n.º 7
0
        public void SimpleInterestTest()
        {
            double amount   = SimpleInterest.GetAmount(principal, rate, time);
            double interest = SimpleInterest.GetInterest(principal, rate, time);

            Assert.AreEqual(principal, SimpleInterest.GetPrincipal(amount, rate, time));
            Assert.AreEqual(time, SimpleInterest.GetTime(interest, principal, rate));
            Assert.AreEqual(rate, SimpleInterest.GetRate(interest, principal, time));
        }
Ejemplo n.º 8
0
        static void Main(string[] args)
        {
            Interest interest = new SimpleInterest();

            interest.CalculateInterest(1000, 5, 6);
            Interest interest2 = new CompoundInterest();

            interest2.CalculateInterest(1111, 2, 5);
        }
        public void Calculate_CentPrincipal_ReturnTotalAmountRoundCent()
        {
            double principal       = 1500.50;
            double interestPercent = 4.3;
            int    years           = 4;

            double dollars = SimpleInterest.Calculate(principal, interestPercent, years);

            Assert.That(dollars, Is.EqualTo(1758.59));
        }
        public void Calculate_PrincipalAndRateAndYears_ReturnTotalAmount()
        {
            double principal       = 1500.00;
            double interestPercent = 4.3;
            int    years           = 4;

            double dollars = SimpleInterest.Calculate(principal, interestPercent, years);

            Assert.That(dollars, Is.EqualTo(1758.00));
        }
Ejemplo n.º 11
0
        static void Main(string[] argd)
        {
            SimpleInterest   oSI = new SimpleInterest(5000, 12.5, 5);
            CompoundInterest oCI = new CompoundInterest(5000, 12.5, 5, 3);


            oSI.Calculate(); oCI.Calculate();
            CompareInterest compare = new CompareInterest();

            compare.Compare(oSI, oCI);

            Console.WriteLine();
            Console.WriteLine("Press any key");
            Console.ReadLine();
        }
Ejemplo n.º 12
0
        static void Main(string[] args)
        {
            SimpleInterest s = (P, N, R) =>
            {
                return(P * R * N / 100);
            };

            Console.WriteLine("Enter P :");
            decimal principal = decimal.Parse(Console.ReadLine());

            Console.WriteLine("Enter N : ");
            decimal year = decimal.Parse(Console.ReadLine());

            Console.WriteLine("Enter R : ");
            decimal rate = decimal.Parse(Console.ReadLine());

            Console.WriteLine("Simple Interest is : " + s(principal, year, rate));

            Console.ReadLine();
        }
Ejemplo n.º 13
0
        static void Main(string[] args)
        {
            SimpleInterest s1 = (P, N, R) =>
            {
                return(P * R * N / 100);
            };

            Console.WriteLine("Enter P :");
            decimal pri = decimal.Parse(Console.ReadLine());

            Console.WriteLine("Enter N : ");
            decimal re = decimal.Parse(Console.ReadLine());

            Console.WriteLine("Enter R : ");
            decimal ne = decimal.Parse(Console.ReadLine());

            Console.WriteLine("Simple Interest is : " + s1(pri, re, ne));

            Console.ReadLine();
        }
Ejemplo n.º 14
0
        static void Main(string[] args)
        {
            SimpleInterest oSI = new SimpleInterest(5000, 15.5, 3);

            oSI.Calculate();
            oSI.Display();
            oSI = null;

            CompoundInterest oCI = new CompoundInterest(5000, 15.5, 3, 4);

            oCI.Calculate();
            oCI.Display();


            oCI.DeductServiceCharge(250);
            oCI.Calculate();
            oCI.Display();
            oCI = null;



            Console.WriteLine("Press a key...");
        }
 public InterestController(SimpleInterest si)
 {
     Si = si;
 }
Ejemplo n.º 16
0
 public InterestController(SimpleInterest simpleInterest)
 {
     _simpleInterest = simpleInterest;
 }
Ejemplo n.º 17
0
 public void Setup()
 {
     si = A.Fake <SimpleInterest>();
 }
 public SimpleInterestStepDefinition(SimpleInterest simpleInterest)
 {
     _simpleInterest = simpleInterest;
 }
Ejemplo n.º 19
0
 public void Setup()
 {
     _simpleInterest = A.Fake <SimpleInterest>();
     m = A.Fake <Maths>();
 }
Ejemplo n.º 20
0
        static void Main(string[] args)
        {
            SimpleInterest si = new SimpleInterest();

            Console.WriteLine(si.FindInterest(1000, 10, 12));
        }
Ejemplo n.º 21
0
 public void Setup()
 {
     ci = A.Fake <CompoundInterest>();
     si = A.Fake <SimpleInterest>();
     m  = A.Fake <Maths>();
 }