#include <stdio.h>
int main()
{
char membershiptype;
int purchase;
//float monthly_reward;
// enter membership type;
printf("membership type: ");
scanf("%c", &membershiptype);
printf("Standard = S , Plus = P , Premium = A");
switch(membershiptype)
{
case 'S':
printf("\n\nEnter the total monthly purchase :RM");
scanf("%d", &purchase);
if (purchase < 75)
printf("\nMonthly Reward :RM%.0f \n\n",(purchase*0.05));
else if (purchase > 75 && purchase < 149.99)
printf("\nMonthly Reward :RM%.0f \n\n",(purchase*0.075));
else if (purchase > 150)
printf("\nMonthly Reward :RM%.0f \n\n",(purchase*10.0));
break;
case 'P':
printf("\n\nEnter the total monthly purchase :RM");
scanf("%d", &purchase);
if (purchase < 150)
printf("\nMonthly Reward :RM%.0f \n\n",(purchase*0.06));
else if (purchase > 150)
printf("\nMonthly Reward :RM%.0f \n\n",(purchase*13.0));
break;
case 'A':
printf("\n\nEnter the total monthly purchase :RM");
scanf("%d", &purchase);
if (purchase < 200)
printf("\nMonthly Reward :RM%.0f \n\n",(purchase*0.04));
else if (purchase > 200)
printf("\nMonthly Reward :RM%.0f \n\n",(purchase*0.15));
break;
default:
printf("Invalid Membership");
} // end of switch
}
muhd.hadziq 0 Newbie Poster
Banfa 597 Posting Pro Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.