Using C programming
Create a function called printMenu( ) with the following properties:
Has no function inputs or output.
Prints the following menu to the screen:
1. Enter user name.
2. Enter scores.
3. Display average score.
4. Display summary.
5. Quit
Create a function called printLine( ) with the following properties:
Takes as input a char
Takes as input an integer corresponding to the number of times to print the character
Has no function output.
For example, if we were to call printLine('*', 10), it should print : **********
Create a function called getAvg( ) with the following properties:
Takes as inputs 3 floating-point numbers
Returns as output a floating-point number corresponding to the average of three numbers.
Do not use printf or scanf inside this function
Create a function called getGradeLetter( ) with the following properties:
Takes a floating-point number containing the percentage
Returns a char corresponding to the letter grade of the percentage.
Do not use printf or scanf inside this function
//function for printMenu
void printMenu( )
{
printf("1. Enter user name.\n");
printf("2. Enter scores.\n");
printf("3. Display average score.\n");
printf("4. Display summary.\n");
printf("5. Quit");
}
//function for printLine
void printLine(char ch,int n)
{
for (int i=0;i<n;i++)
printf("%c",ch);
}
//function for getAvg
float getAvg(float num1,float num2,float num3)
{
return (num1+num2+num3)/3;
}
//function for getGradeLetter
char getGradeLetter(float num)
{
if (num>=90)
return 'A';
else if (num>=80 && num<90)
return 'B';
else if (num>=70 && num<80)
return 'C';
else if (num>=40 && num<70)
return 'D';
else
return 'F';
}
Get Answers For Free
Most questions answered within 1 hours.