Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ Objectives: In this project, we will practice working with: Functions, Files and arrays. Tasks: You will calculate the grade of a student based on

C++ Objectives: In this project, we will practice working with: Functions, Files and arrays.

Tasks: You will calculate the grade of a student based on the marks. Total marks of a student are calculated as follows

Total marks = Lab marks*25% + Project marks*25% + Test marks* 50%

3 Projects are assigned to the student and you need to consider the maximum of all the marks as the Project marks. Each project is evaluated to 100 marks.

Student will be having 5 labs. You need to calculate the average of all labs as lab marks. Each lab is evaluated to 100 marks.

Students will have 2 tests. You need to calculate the weighted mean of those marks using the below formula. Each test is evaluated to 100 marks Weighted mean = ((2*maximum marks + minimum marks)/3)

Grade should be assigned based on the following criteria.

If Total marks > 90, Total marks between 80 and 89, Total marks between 70 and 79, Total marks between 60 and 69, Total marks < 60,

grade-A, Comments- Outstanding grade-B, Comments-Good grade-C, Comments- Needs to improve grade-D, Comments- Warning of probation grade-F, Comments-Failed

Additionally, the project has several menu options. After a user has calculated the marks for each individual sections and selected the choice to calculate total marks, the program should terminate by printing out the name, total marks, grade and comments both to the console and a file.

Constraints:

Do not use any cin or cout statements inside main() function.

Do not use any Global Variables.

Write a function (use Void function and call by reference mechanism) which prompts the user

to enter the name of the student.

Test Module: Write a function which accepts two call by reference parameters of type double

and returns a value of type double. Inside the function, prompt the user to give input and then calculate the weighted mean as mentioned above and return it.

Project Module: Write a function which accepts an array parameter, size of the array and returns the value of type double. Inside the function, prompt the user to give input and store them in an array. Calculate the maximum of the three projects and return it.

Lab Module: Write a function which accepts an array parameter, size of the array and returns the value of type double. Inside the function, prompt the user to give input and store them in an array. Calculate the average of lab marks and return it.

You should use a void function named, print for printing the name and grade to the console.

In the same function, write the name and each individual marks, the marks considered for final grading, total marks, grade and comments to a file.(see the sample output)

Hint: The declaration will be as follows:

void print(double test1, double test2, double lab[], int no_of_labs, double project[], int no_of_projects, weighthed_mean, best_of_project, average_of_labs, total_marks, grade, comments);

Make sure your program selects each menu item only once.

Handle invalid menu choice i.e., when the user selects a menu choice that is not in the menu.

The menu choice to calculate total marks should be selected only after selecting all other

choices.

Any invalid test marks, project marks or lab marks should display an error message and

prompt the user to re-enter the marks.

Expected Output:

Enter the name of the student: John Select a menu choice from the following options.

Project Marks

Lab Marks

Test Marks

Calculate total marks

>a

Enter Project1 marks>90 Enter Project2 marks>120 Invalid marks entered. Project marks should be between 0 and 100

Enter Project2 marks>80 Enter Project3 marks>85

The Project marks considered for grading are 90

Select a menu choice from the following options.

Project Marks

Lab Marks

Test Marks

Calculate total marks

>h This is an invalid menu choice. So please select the correct choice. Select a menu choice from the following options.

Project marks

Lab marks

Test marks

Calculate total marks

>c

Enter test1 marks> -10 The marks entered is invalid. Test marks should be between 0 and 100

Enter test1 marks>80 Enter test2 marks>90

The test marks considered for grading are 86.66 Select a menu choice from the following options.

Project marks

Lab marks

Test marks

Calculate total marks

>d

You should select all other choices before selecting this choice. Select a menu choice from the following options.

Project marks

Lab marks

Test marks

Calculate total marks

Enter marks of lab1>100 Enter marks of lab2>90 Enter marks of lab3>130 The marks entered is invalid. Lab marks should be between 0 and 100 Enter marks of lab3>80

Enter marks of lab4>60 Enter marks of lab5>100

The lab marks considered for grade are: 86 Select a menu choice from the following options.

Project marks

Lab marks

Test marks

Calculate total marks

>b This menu choice is already selected. Please select a choice which is not selected yet. Select a menu choice from the following options.

Project marks

Lab marks

Test marks

Calculate total marks

>d

Output to the console:

Student name is John Grade : B

Output to a file:

Student Name: John

Project1 marks: 90 Project2 marks: 80 Project3 marks: 85 The best of project marks are : 90

Test1 marks: 80 Test2 marks: 90 The Weighted mean of test marks are : 86.66

Lab1 marks: 100 Lab2 marks: 90 Lab3 marks: 80 Lab4 marks: 60 Lab5 marks: 100 The average of lab marks are: 86

Total marks obtained : 87.10 Comments - Very good

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

1 2 3 Data Base Techniques

Authors: Dick Andersen

1st Edition

0880223464, 978-0880223461

More Books

Students also viewed these Databases questions