Answer to Question #304722 in C# for kun

Question #304722

People who earn less than R6 000.00 or who are older than 70 years do not pay tax. Write a program that reads in a person’s salary and age. If the person should pay tax, your program should request the tax percentage. The program must finally display an appropriate message.


1
Expert's answer
2022-03-03T09:58:54-0500
using System;

namespace Tax
{
    class Program
    {
        public static void Main(string[] args)
        {
            double salary, tax, taxperc;
            int years;
            Console.Write("Enter salary: ");
            salary = Convert.ToDouble(Console.ReadLine());            
            Console.Write("Enter age: ");
            years = Convert.ToInt32(Console.ReadLine());
            tax = 0;    
            if ((salary >= 6000) && (years < 70))
            {
                Console.Write("Enter tax percentage: ");
                taxperc = Convert.ToInt32(Console.ReadLine());
                tax = (salary * taxperc)/100;
                Console.WriteLine();
                Console.WriteLine("Tax: R{0:f2}", tax);
            }
            else
            {
                Console.WriteLine();
                Console.WriteLine("Not pay tax");
            }
            Console.WriteLine();            
            
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }
    }
}

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
New on Blog
APPROVED BY CLIENTS