Please, help me with my assignment. Please, anyone with a big kind heart :

write a c++ program to give the 30 students final grade in a course with the ff. grading scheme: there are five quizzes worth 20 pts. each, a laboratory worth 100 pts., and exam worth 100 pts. The grade is based on the ff weights: 40 % on the exam, 30% on the laboratory and 30% on the quiz average. The grade is determined from the weighted average in the traditional way: 95 or over is an A, below 95 down to 85 is B, below 85 to 70 is a C, and below 70 is an F. Use Array to input 30 students and Function/Module in computation.

Dani AI

Generated

raised a clear classroom-style grading task and and were right to ask for effort first. The following gives a compact, practical plan and a small set of functions that match the "array + function" approach while clarifying common pitfalls (validation, integer truncation, boundary checks).

Recommended decomposition: a Student record containing five quiz scores, a lab score and an exam score; an array of 30 Student objects; and three functions: weightedScore(const Student&), letterGrade(double), and a small input/validation helper. Keep arithmetic in double to avoid integer truncation. Treat the five quizzes together as a 0..100 subtotal (since 5 * 20 = 100) and apply weights inside weightedScore so weights are centralized and easy to change.

A compact implementation sketch (functions only):

struct Student {
  int quizzes[5]; // each 0..20
  int lab;        // 0..100
  int exam;       // 0..100
};

double weightedScore(const Student& s) {
  int sum = 0;
  for (int i = 0; i < 5; ++i) sum += s.quizzes[i]; // max 100
  double quizPart = (sum / 100.0) * 30.0; // quizzes weight 30%
  double labPart  = (s.lab / 100.0)  * 30.0; // lab weight 30%
  double examPart = (s.exam / 100.0) * 40.0; // exam weight 40%
  return quizPart + labPart + examPart; // final numeric score 0..100
}

char letterGrade(double score) {
  if (score >= 95.0) return 'A';
  if (score >= 85.0) return 'B';
  if (score >= 70.0) return 'C';
  return 'F';
}

Troubleshooting notes: validate quiz entries as 0..20 and lab/exam as 0..100, re-prompt on bad input, and print final scores with fixed precision (e.g., std::fixed + std::setprecision(2)). Test boundary values (94.999 vs 95.000) to confirm letter-grade behavior. This structure keeps input, computation and output separate so further changes (different weights, dropping a lowest quiz) require edits in only one place.

Recommended Answers

All 3 Replies

Post what you have done so far to show you've made some effort. Nobody is going to do your assignments for you.

Please, help me with my assignment. Please, anyone with a big kind heart :

write a c++ program to give the 30 students final grade in a course with the ff. grading scheme: there are five quizzes worth 20 pts. each, a laboratory worth 100 pts., and exam worth 100 pts. The grade is based on the ff weights: 40 % on the exam, 30% on the laboratory and 30% on the quiz average. The grade is determined from the weighted average in the traditional way: 95 or over is an A, below 95 down to 85 is B, below 85 to 70 is a C, and below 70 is an F. Use Array to input 30 students and Function/Module in computation.

We are ready to help if you show us that you have put in some effort.
So Post down the code and ask for any specific help you require in order for you to solve your assignment

ok thanks for encouraging me. i will do my best for this. and i will post it later if there's an errors please guide me. thanks! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.