Answer to Question #264216 in C# for Tori

Question #264216

Create a program that can calculate the minimum payment that is needed to be paid to a credit card company based on the amount owed and a given interest rate. The amount owed will be the interest or $10, whichever is greater OR the amount owing if the amount owed is less than $10.


1
Expert's answer
2021-11-11T07:31:04-0500
using System;

namespace Q264216
{
  //Create a program that can calculate the minimum payment that is needed to be paid
  //to a credit card company based on the amount owed and a given interest rate.
  //The amount owed will be the interest or $10, whichever is greater
  //OR the amount owing if the amount owed is less than $10.
  class Program
  {
    static void Main(string[] args)
    {
      Console.WriteLine("Enter amount owed on credit card");
      var amtOwed = Convert.ToDecimal(Console.ReadLine());
      Console.WriteLine("Enter an interest rate value as a percentage with the '%' character (this will be the APR)");
      var interestRatePercent = Console.ReadLine();
      Console.WriteLine("Assume 1 year term...\n");
      var interestRateValue = Convert.ToDecimal(interestRatePercent.Remove(interestRatePercent.Length - 1, 1));
      var interestRatePercentToDecimal = interestRateValue / 100;
      if (amtOwed < 10)
      {
        Console.WriteLine($"Amount Owed is: ${amtOwed}");
      }
      else
      {
        //amount that is just interest: I = P*r
        var i = amtOwed * interestRatePercentToDecimal;
        //decide if interest balance is greater than 10, if so then finalAmount is interest balance, else $10
        decimal finalAmount = i > 10.00m ? i : 10.00m;
        Console.WriteLine($"Amount Owed is: ${finalAmount}");
      }
    }
  }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS