Ask the user to enter 3 scores each representing an assignment score. Ask the user for their midterm and final exam. Store all above input into variables. Display the total weighted score as follows where all scores entered will be out of 100: Total Weighted Score = (average assignments)*40% + (midterm)*30% + (final exam)*30% Use constants to represent the weight of assignments, midterm and the final. Show the output of "Your final score is: X" where x is the final total calculated score. Add top-level comments and other comments as needed but do not comment every line. Overuse of comments is as bad as not using them.

Respuesta :

Answer:

#include <stdio.h>

int main()

{

   float assignmentScore, averageScore, midTerm, finalTerm, totalScore;

   

   printf("Enter first assignment score: ");

   scanf("%f",&assignmentScore);

   averageScore += assignmentScore;

   printf("Enter second assignment score: ");

   scanf("%f",&assignmentScore);

   averageScore += assignmentScore;

   printf("Enter third assignment score: ");

   scanf("%f",&assignmentScore);

   averageScore += assignmentScore;

   averageScore = averageScore / 3;

   

   printf("Enter mid term score: ");

   scanf("%f",&midTerm);

   

   printf("Enter final term score: ");

   scanf("%f",&finalTerm);

   

   totalScore = (averageScore*0.40)+(midTerm*0.30)+(finalTerm*0.30);

   

   printf("Your total score is equal to %f\n",totalScore);

   

  return 0;

}

Explanation:

  • Declare and get the assignments score, average score, mid term, final term from the user an input.
  • Calculate the average score by calculating all the scores and dividing by the total no. of assignments.
  • Calculate the total score by using the following formula:

Total Score = (average assignments)*40% + (midterm)*30% + (final exam)*30%

  • Lastly, display the total score on the console.