Question

Implement a C program to calculate the Average Score Point(ASP) of a student taking N courses...

Implement a C program to calculate the Average Score Point(ASP) of a student taking N courses in a

semester. Ask the user for the number of courses(N) the student is taking in the semester, and check if the

number of courses is greater than 1 (>1). If the number of courses is less than or equal to 1(<=1), display

an error and ask the user to try again until the right input is entered.

Next, ask the user for the student score for each course. Use the student score entered to determine the

equivalent score point. Use the Table 1 scale below to assign a point to each score.

To calculate the ASP, sum up the score point for the courses and divide by the Number of courses (N).

Once you have calculated the ASP, make a comment on the student transcript based on this ASP using the

Table 2 to determine the comment for each ASP

. Call the functions listed below to implement each of

the operations described above

.

Table 1

: Showing Point obtainable for each score

Score (%)

Point

95 - 100

4

90 - 94

3.5

85 – 89

3

80 - 84

2.5

75 -79

2

70 - 74

1

less than 70

0

Table 2

: Comment on Student Transcript

ASP

Comment

3.8 – 4.0

Excellent

3.5 – 3.7

Very Good

3.0 – 3.49

Good

2.5 – 2.99

Satisfactory

2.0 – 2.49

Not Passed

0 – 1.99

Unofficial drop

Implement the following functions for the lab assignment:

int courseNumCheck(int)-

Takes the user input as an argument (integer type) and checks if the number of

courses is greater than 1. Returns 1 if true else 0.

float getScore(void)

Takes no argument, and Returns the course score input by the user.

float getScorePoint(float)

– Takes the course score as an argument (float type) and Returns the score point.

void printComment(float)

– Takes the ASP as an argument (float type) and prints the comment associated

with an ASP.

Sample Outputs

Character in bold are inputs from the user:

xalevK:~$ compile prelab4.c

xalevK:~$ ./a.out

========================================

STUDENT ASP CALCULATOR

========================================

Enter the Number of Courses:

2

Enter the Student Score for Course 1 (Percent):

91

Point = 3.50

Enter the Student Score for Course 2 (Percent):

83

Point = 2.50

The Student ASP: 3.00

========================================

COMMENT: Good

========================================

xalevK:~$ ./a.out

========================================

STUDENT ASP CALCULATOR

========================================

Enter the Number of Courses:

0

Error! Please enter a Number of Courses greater than 1:

-1

Error! Please enter a Number of Courses greater than 1:

1

Error! Please enter a Number of Courses greater than 1:

4

Enter the Student Score for Course 1 (Percent):

20

Point = 0.00

Enter the Student Score for Course 2 (Percent):

59

Point = 0.00

Enter the Student Score for Course 3 (Percent):

84

Point = 2.50

Enter the Student Score for Course 4 (Percent):

96

Point = 4.00

The Student ASP: 1.62

========================================

COMMENT: Unofficial drop

========================================

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<stdio.h> //for printf and scanf
//couseNumCheck function
int courseNumCheck(int n)
{
if(n>1)
return 1;
else return 0;
}
//getScore function
float getScore()
{
float score; //to store the user input
scanf("%f",&score);
return score;
}
//getScorePoint function
float getScorePoint(float score)
{
if(score>=95&&score<=100)
return 4;
else if(score>=90&&score<=94)
return 3.5;
else if(score>=85&&score<=89)
return 3;
else if(score>=80&&score<=84)
return 2.5;
else if(score>=75&&score<=79)
return 2;
else if(score>=70&&score<=74)
return 1;
else if(score<70)
return 0;
}
//printComment function
void printComment(float ASP)
{
if(ASP>=3.8&&ASP<=4)
printf("Excellent");
else if(ASP>=3.5&&ASP<=3.7)
printf("Very Good");
else if(ASP>=3&&ASP<=3.49)
printf("Good");
else if(ASP>=2.5&&ASP<=2.99)
printf("Satisfactory");
else if(ASP>=2&&ASP<=2.49)
printf("Not Passed");
else if(ASP>=0&&ASP<=1.99)
printf("Unofficial drop");
}
//main function
void main()
{
int n,i;
printf("============================================================");
printf("\nSTUDENT ASP CALCULATOR\n");
printf("============================================================");
printf("\nEnter the Number of Courses: "); //prompts user for number of scores
scanf("%d",&n);
while(courseNumCheck(n)==0) //loops and asks the user until he enters greater than 1
{
printf("Error! Please enter a Number of Courses greater than 1: ");
scanf("%d",&n);
}
float sum=0,score_point; //sum to store the score points
for(i=0;i<n;i++) //loops n times and takes the course scores
{
printf("\nEnter the Student Score for Course %d (Percent): ",i+1);
score_point = getScorePoint(getScore()); //calls the getScore function and the value is passed to getScorePoint function
printf("Point = %f",score_point);
sum += score_point;//adds the score point to sum
}
float ASP = sum/(float)n; //evaluates and stores in ASP (float variable)
printf("\nThe Student ASP: %f",ASP); //prints the ASP value
printf("\n=============================================================");
printf("\nCOMMENT: ");
printComment(ASP);//calls the printComment function
printf("\n=============================================================");
}

//output screenshot

STUDENT ASP CALCULATOR Enter the Number of Courses: 0 Error! Please enter a Number of Courses greater than 1: -1 Error! Please enter a Number of Courses greater than 1: 1 Error! Please enter a Number of Courses greater than 1: 4 Enter the Student Score for Course 1 (Percent): 20 Point-0.000000 Enter the Student Score for Course 2 (Percent): 59 Point 0.000000 Enter the Student Score for Course 3 (Percent): 84 Point-2.500000 Enter the Student Score for Course 4 (Percent): 96 Point 4.000000 The Student ASP: 1.62500 COMMENT: Unofficial drop

//any query, post in the comment section

Add a comment
Know the answer?
Add Answer to:
Implement a C program to calculate the Average Score Point(ASP) of a student taking N courses...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Write a C++ program to implement this task. Students are registered in 3 courses in a...

    Write a C++ program to implement this task. Students are registered in 3 courses in a semester. To pass each course, students have to make a grade greater than or equal to 40. You have to write a program to determine if the student will pass or fail the semester, based on the following criteria: A student passes if all three courses are passed. Additionally, a student may pass if only one subject is failed, and the overall average grade...

  • In this assignment you are asked to write a python program to maintain the Student enrollment...

    In this assignment you are asked to write a python program to maintain the Student enrollment in to a class and points scored by him in a class. You need to do it by using a List of Tuples What you need to do? 1. You need to repeatedly display this menu to the user 1. Enroll into Class 2. Drop from Class 3. Calculate average of grades for a course 4. View all Students 5. Exit 2. Ask the...

  • GPA calculator: Assume the user has a bunch of courses they took, and need to calculate...

    GPA calculator: Assume the user has a bunch of courses they took, and need to calculate the overall GPA. We will need to get the grade and number of units for each course. It is not ideal to ask how many courses they took, as they have to manually count their courses. Programming is about automation and not manual work. We will create a textual menu that shows 3 choices. 1. Enter course grade and units. 2. Show GPA. 3....

  • Write a program that will calculate each student’s average score over several tests. The program will...

    Write a program that will calculate each student’s average score over several tests. The program will ask for the number of students, and the number of scores per student. Then, for each student, it will ask for all test results and display the average. The output should look similar to what is shown below (sample user input is shown in bold) ( write by python and Screenshot it for me , thank) How many students do you have? 3 How...

  • C++ only Implement a program that prompts a user to enter a number N where N...

    C++ only Implement a program that prompts a user to enter a number N where N is a positive number. The program must validate a user input and ask a user to re-enter until an input is valid. Implement a function that pass N as an argument and return a result of calculates N! (N-factorial): The function must use loop for the implementation. Hint: Factorial: N! = N * (N-1) * (N-2) * …. * 1 ( This is only...

  • Python GPA calculator: Assume the user has a bunch of courses they took, and need to...

    Python GPA calculator: Assume the user has a bunch of courses they took, and need to calculate the overall GPA. We will need to get the grade and number of units for each course. It is not ideal to ask how many courses they took, as they have to manually count their courses. Programming is about automation and not manual work. We will create a textual menu that shows 3 choices. 1. Input class grade and number of units. 2....

  • Tuition Payment In C++, Write a program that will calculate the total college costs for a...

    Tuition Payment In C++, Write a program that will calculate the total college costs for a student. The program will ask the user for the number of credit hours that the student is taking, the number of lab courses that the student is taking, and whether the student is "in district". The tuition is calculated by multiplying the number of credit hours times the cost per credit plus lab fees. For "in district" students the cost is $70.00 per credit...

  • Problem Specification: Write a C++ program to calculate student’s GPA for the semester in your class. For each student, the program should accept a student’s name, ID number and the number of courses...

    Problem Specification:Write a C++ program to calculate student’s GPA for the semester in your class. For each student,the program should accept a student’s name, ID number and the number of courses he/she istaking, then for each course the following data is needed the course number a string e.g. BU 101 course credits “an integer” grade received for the course “a character”.The program should display each student’s information and their courses information. It shouldalso display the GPA for the semester. The...

  • python program sample output Problem 3 (Taking User Input) Write a function called userGuess(n) that takes...

    python program sample output Problem 3 (Taking User Input) Write a function called userGuess(n) that takes an integer n as an argument. This function should display n to the user and prompt them to enter the number num that is the largest power of 2 less than or equal to n. Have your function return the user's input num (it will be used in the next problem) Problem 4 (Making a Game) Finally, create a main() function for your program....

  • c++ Write a program that computes and displays the tuition for courses offered at the University....

    c++ Write a program that computes and displays the tuition for courses offered at the University. First, the program should ask if the student has registered for a regular course or a course with a lab component. The user can enter the letter 'C' or 'c' for lecture course only, or the letter 'L' or 'l' for a laboratory course . Write a function called Menu, which takes no input parameters and returns a char value. Your main program will...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT