Something like the following code should do the trick, provided you complete it (just plan 'A' is covered') and make it robust.
#include<stdio.h>
int get_description(const char type_plan[], const char ** description, const char ** claim_limit )
{
int result = 0;
switch (type_plan[0])
{
case 'A':
*description = "Room Charges 150/day\nIntensive Care Unit (ICU) Charges 300/day\nHospital Supplies and Services : As charged. Subject to approval by EZMediLife. Surgical Fees\n";
switch(type_plan[1])
{
case '1':
*claim_limit = "Annual Claim Limit 100.000\n";
break;
case '2':
*claim_limit = "Lifetime Claim Limit 500000\n";
break;
default:
result = -1;
break;
}
break;
case 'B':
case 'C':
default:
result = -1;
break;
}
return result;
}
int main()
{
const char * plane[] = { "A1", "K3", "A2" }; -- test planes
for ( size_t n=0; n<sizeof(plane) / sizeof(plane[0]); ++n)
{
const char * description, * claim_limit;
if ( get_description( plane[n], &description, &claim_limit) == 0)
{
printf("plane %s: %s%s", plane[n], claim_limit, description);
}
else
{
printf("unknown plane %s\n", plane[n]);
}
printf("\n");
}
return 0;
}