Knowledge Walls
Gopal Rao
Mumbai, Maharashtra, India
Passcode:
C# program to find Pay Back Amount according to credit charges
3098 Views
Function 
This program find the pay back amount according to the credit charges amount.I have done this with ladder if condition
Code
	using System;
	using System.Collections.Generic;
	using System.Linq;
	using System.Text;
	
	namespace CreditCardCharge
	{
	   class Program
	   {
	       static void Main(string[] args)
	       {
	           Console.WriteLine("Enter Creadit Charges");
	           double charge = Convert.ToDouble(Console.ReadLine());
	           Console.WriteLine("Pay Back Amount : " + getPayBackAmount(charge).ToString());
	           Console.ReadKey();
	        }
	       static double getPayBackAmount(double charge)
	       {
	           if (charge <= 500)
	           {
	               return ((charge * .25) / 100);
	           }
	           else if(charge > 500 && charge <= 1500)
	           {
	               return ( ((500 *.25)/100) + (((charge-500)*.5)/100));
	           }
	           else if (charge > 1500 && charge <= 2500)
	           {
	              return (((500 * .25) / 100) + ((1000 * 0.5) / 100) + ((charge - 1500) * .75) / 100);
	           }
	          else
	           {
	              return (((500 * .25) / 100) + ((1000 * .5) / 100) + ((1000) * .75) / 100 + ((charge-2500)* 1.0)/ 100);
	           }
	        }
	   }
	}
Output 
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details