Procedural Programming Assignment: Student Progress Tracker at ABC College
Overview This assignment is to be implemented using procedural programming. The overall program should fol- low the progress of students through a sequence of subjects that are part of an academic course at an educational institute ABC (A Big College). Our marking system will run on Capa and Codeblocks. AlthoughHowever, to support students, we agree to support Visual Studio Code for lab only. For assignments, we just use Capa and Codeblocks to mark. Make sure that your code can run on both system. General code notes These are some general rules about what you should and shouldn’t do.
1. Your assignment should be organised into: (a) A driver file containing your main() function. (b) A header file containing the prototypes for the functions you write. (c) An implementation file containing the implementations of your functions.
6. Don’t leak memory.
7. Your main() function should make it clear what is going on, and shouldn’t be too large.
At this point you should report the student name, subject attempted, and the distribution parameters to the Output-file. * Determine the mark obtained by the student by generating a random value drawn from the subject distribution (that is, the Mean and Standard deviation). Values less than 0 or more than 100 should be appropriately modified so the mark is an integer in the range 0 to 100. Based on the mark the following different actions are possible:
• 0-50: Fail
1. Students.txt: No more than 10 entries.
Name,Student code,Ability,Consistency,Program name:Subject list
Dusty the Dinosaur,000001,65,3,Master of Extinction:1,2,3,4,5
Iggy the Irratic,369523,50,15,Some Degree of Oddness:7,5,3,1
Basic Bouncing,-10,-2
Counting for Animals,0,2
Network analysis,15,-2
Computing,8,3
File Organization
Driver File: main.cpp
#include <iostream>
#include <fstream>
if (argc != 4) {
std::cerr << "Usage: " << argv[0] << " Students.txt Subjects.txt Output-file" << std::endl;
std::string outputFile = argv[3];
std::vector<Student> students;
}
processStudents(students, subjects, outputFile);
#define FUNCTIONS_H
#include <vector>
int ability;
int consistency;
std::string name;
int difficulty;
void processStudents(const std::vector<Student>& students, const std::vector<Subject>& subjects, const std::string& outputFilename);
#endif // FUNCTIONS_H
#include <sstream>
#include <random>
if (!file.is_open()) {
std::cerr << "Failed to open " << filename << std::endl;
std::istringstream iss(line);
Student student;
iss.ignore();
std::getline(iss, student.program, ':');
student.subjects.push_back(subject);
if (subjectStream.peek() == ',')
file.close();
return true;
std::cerr << "Failed to open " << filename << std::endl;
return false;
Subject subject;
std::getline(iss, subject.name, ',');
return true;
}
return;
}
outputFile << "Student: " << student.name << ", Program: " << student.program << std::endl;
bool excluded = false;
int stddev = student.consistency + subject.variability;
std::normal_distribution<> d(mean, stddev);
int mark = std::round(d(gen));
mark = std::max(0, std::min(100, mark)); // Clamp between 0 and 100
} else if (mark >= 65) {
outputFile << " (Good)" << std::endl;
} else {
outputFile << " (Fail)" << std::endl;
break;
}
outputFile << " " << student.name << " has graduated." << std::endl;
}
To compile and run the program:
1. Open Codeblocks or Capa.
Ensure that Students.txt and Subjects.txt are in the same directory as the executable.
Example command: