Monday, February 28, 2011

Clue Exe 3

switch (type)
{
 case 'a':
         printf ("\n\tType\t:Household");
         if (unit<=500) {(charge=unit*0.1);}
         else if (unit>500) {charge=50+((unit-500)*0.25);}
         printf ("\n\tCharge\t:RM%.2f",charge);
         ;break;

case 'b':
         printf ("\n\tType\t:Office");
         if (unit<=1000) {(charge=unit*0.25);}
         else if (unit>1000) {(charge=250+((unit-1000)*0.5));}
         printf ("\n\tCharge\t:RM%.2f",charge);
         ;break;

case 'c':
         printf ("\n\tType\t:Factory");
         if (unit<=1500) {(charge=unit*0.5);}
         else if (unit>1500) {(charge=750+((unit-1500)*0.75));}
         printf ("\n\tCharge\t:RM%.2f",charge);
         ;break;

default:
        printf ("User type is not recognize");
        ;break;
}

No comments:

Post a Comment