Page 65 - E-Modul Pemrograman Dasar Kelas X
P. 65
Using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class billingException: ApplicationException
{
public billingException()
: base("Nilai tidak boleh kurang dari 1000")
{
}
public int calculate(int amount)
{
int total;
if (amount < 1000)
{
throw new billingException();
}
Else
{
total amount - 1000;
Console.WriteLine("Kelebihan nilai yaitu" + total);
}
return total;
}
}
class Program
{
static void Main(string[] args)
{
try
{
56