Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- void main()
- {
- int a, planType, postpaid, prepaid, minCall, msgSent;
- float billRate, callRate = 0.06 , smsRate = 0.01, totalBill ;
- char custName[100], phoneNum[20];
- printf("Enter your name: ");
- gets(custName);
- printf("\nEnter your phone number: ");
- scanf(" %s", &phoneNum);
- printf("\nWhich phone plan do you want to choose? (1 - postpaid, 2 - prepaid) ");
- scanf(" %d", &planType);
- if (planType == 1) {
- /* for loop execution */
- for( a = 1; a <= 1; a = a + 1 ){
- printf("How many bills do you want to pay? ");
- scanf(" %d", &a);
- }
- printf("\nWhich postpaid plan do you want? (98, 128, 158, 188) ");
- scanf(" %d", &postpaid);
- }
- if (postpaid == 98) {
- printf("\nSubscribed to MaxisONE Plan 98!\nPlan includes 15GB All Day Data, 15GB Weekend Data and unlimited calls & SMS");
- billRate = 98.00;
- }
- else if (postpaid == 128) {
- printf("\nSubscribed to MaxisONE Plan 128!\nPlan includes 40GB All Day Data and unlimited calls & SMS");
- billRate = 128.00;
- }
- else if (postpaid == 158) {
- printf("\nSubscribed to MaxisONE Plan 158!\nPlan includes 50GB All Day Data and unlimited calls & SMS");
- billRate = 158.00;
- }
- else if (postpaid == 188) {
- printf("\nSubscribed to MaxisONE Plan 188!\nPlan includes 60 GB All Day Data and unlimited calls & SMS");
- billRate = 188.00;
- }
- else {
- printf("\nWhich prepaid plan do you want? (35, 45, 60, 70) ");
- scanf(" %d", &prepaid);
- switch(prepaid) {
- case 35 :
- printf("\nSubscribed to Hotlink RED Plan 35!\n30-day validity Plan which includes 6GB All Day Data, free Non-Stop RED Chat or free Non-Stop RED Social");
- billRate = 35.00;
- break;
- case 45 :
- printf("\nSubscribed to Hotlink RED Plan 45!\n30-day validity Plan which includes 8GB All Day Data, free Non-Stop RED Chat or free Non-Stop RED Social");
- billRate = 45.00;
- break;
- case 60 :
- printf("\nSubscribed to Hotlink RED Plan 60!\n30-day validity Plan which includes 6GB All Day Data, unlimited calls & SMS, free Non-Stop RED Chat or free Non-Stop RED Social");
- billRate = 60.00;
- break;
- case 70 :
- printf("\nSubscribed to Hotlink RED Plan 70!\n30-day validity Plan which includes 8GB All Day Data, unlimited calls & SMS, free Non-Stop RED Chat or free Non-Stop RED Social");
- billRate = 70.00;
- }
- }
- printf("\n ");
- printf("\n===================================================\n");
- printf("\t\tMAXIS eBILL");
- printf("\n===================================================\n");
- printf("Name: ");
- puts(custName);
- printf("Phone Number: %s", phoneNum);
- printf("\nPlan Type: %d", planType);
- if (planType == 1) {
- printf("\nPostpaid Plan: %d", postpaid);
- printf("\nTotal Bill: RM %.2f", billRate);
- printf("\n====================================================\n");
- }
- else {
- printf("\nPrepaid Plan: %d", prepaid);
- printf("\nHow many messages sent this month? ");
- scanf(" %d", &msgSent);
- printf("How long are your calls this month? (minutes) ");
- scanf(" %d", &minCall);
- totalBill = (callRate*2*minCall) + (smsRate*msgSent) + billRate;
- printf("Total Bill: %.2f", totalBill);
- printf("\n===================================================\n");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement