Write a program that computes and assesses the tuition fee of the
students in one trimester, based on the given mode of payment below:
Plan (key) Discount (-) or Interest (+)
Cash (1). 10% discount
Two-Installment (2) 5% discount
Three-Installment(3) 10% interest
The target-user must use the key in selecting or choosing the mode of payment. The first input
data is the tuition fee, and the second input data is the mode of payment.
Sample input/output dialogue:
Enter tuition fee: 20,000 Input data
(Press 1 for Cash, 2 for Two-Installment, 3 for Three-Installment)
Enter mode of payment: 2 Second input data
Your total tuition fee is: 19,000 Output data
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
try
{
Console.Write("Enter tuition fee: ");
string str = Console.ReadLine();
int amount = int.Parse(str);
Console.WriteLine("(Press 1 for Cash, 2 for Two-Installment, 3 for Three-Installment)");
Console.Write("Enter mode of payment:");
str = Console.ReadLine();
int mode = int.Parse(str);
int result = 0;
if (mode == 1)
{
result = (int)(amount * 0.9); // 10% discount
}
else if (mode == 2)
{
result = (int)(amount * 0.95); // 5% discount
}
else if (mode == 3)
{
result = (int)(amount * 1.1); // 10% interest
}
else
{
Console.WriteLine("Bad mode.");
return;
}
Console.WriteLine("Your total tuition fee is: {0}", result);
}
catch
{
Console.WriteLine("Bad number.");
}
}
}
}
Comments
Leave a comment