People who earn less than R6 000.00 do not pay tax. Write a program that reads in a person’s salary. If he earns R6 000.00 or more, the program must request the percentage tax the person pays. The program must then finally display one of the following messages (as an example): For a person who earns R1500.00 You do not pay tax, and your final payout is R1500.00 For a person who earns R8200.00 and whose tax is 10% You pay R820.00 tax, and your final payout is R7380.00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApp2
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine("Please enter salary: ");
int salary = Convert.ToInt32(Console.ReadLine());
if (salary > 6000)
{
Console.WriteLine("Please enter person's tax: ");
int tax = Convert.ToInt32(Console.ReadLine());
decimal pay = salary / 100 * tax;
Console.WriteLine("Your tax: {0}, final payout: {1}", pay, salary - pay);
}
else
{
Console.WriteLine("Final payout: {0}", salary);
}
Console.ReadKey();
}
}
}
Comments
Leave a comment