Page 73 - E-Modul Pemrograman Dasar Kelas X
P. 73

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;

                        }

                 }






                                                             65
   68   69   70   71   72   73   74   75   76   77   78