Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program using four enumerators. Initialize each as follows: 1. first, se

ID: 3538454 • Letter: W

Question

Write a program using four enumerators. Initialize each as follows:

1. first, second, third, fourth, fifth, sixth, seventh, eighth, ninth

2. Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday

3. curve, fast, knuckle, slider

4. single, double, triple, homer


The program should prompt a user to input a character array or 4 numbers pertaining to each

enumerator. Display help text to assists the user. The help text should display the smallest

and largest possible values for each inputted number. Validate the input. Display an error

message for a number entered outside the range of the enumerator.


Using the enumerators, generate a sentence that will display as follows:


In the fifth inning on Saturday, I hit a fast ball for a triple. ;

where (fifth, Saturday, fast and triple) are printed using the input generated from their

respective enumerators.

The input that produced the statement above would be: 4612

The program should loop allow the user to decide whether or not he or she wishes to process

the loop again.

Explanation / Answer

#include<stdio.h>

int main()

{

char num[9][11]={"first", "second", "third", "fourth", "fifth", "sixth", "seventh","eighth", "ninth"};

char day[7][15]={"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday"," Friday", "Saturday"};

char grm1[4][10]={"curve", "fast"," knuckle", "slider"};

char grm2[4][10]={ "single", "double", "triple", "homer"};

char val[4];

int i,j;

printf("enter input");

gets(val);

  

printf(" in the %s innings on %s,i hit a %s ball for a %s ",num[val[0]-'0'],day[val[1]-'0'],grm1[val[2]-'0'],grm2[val[3]-'0']);

  


}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote