Question
Objectives : Learn (1) how to implement functions by passing arrays as arguments and (2) how to use Graphics with SFML Graphics Application Programmer Interface
Objectives: Learn (1) how to implement functions by passing arrays as arguments and (2) how to use Graphics with SFML Graphics Application Programmer Interface (API). Instructions: This assignment is to write a program that will display a histogram representing the number of scores associated with each grade. Your program should execute with the following behavior. Step 1: Get from the user the number of possible different letter grades, maximum anticipated students in a given letter grade, and the file containing the scores. Step 2: For each letter grade. Step 2.1: Get from the user the grade string and range of possible scores for that grade. Step 2.2: Open the file containing the scores. Step 2.3: Determine the number of scores in the file in the specified range. Step 2.4: Close the file. Step 3: Label the grade and draw the grade bar. Step 4: Diagnostics If the total number of scores does not match the number of scores in the specified grade ranges, you should print the following messages: The total number of scores is greater than the number of scores in the specified grade ranges. Make sure the ranges include all possible grades and try again. (This may occur when the grade ranges do not span the range of 0 100) The number of scores in the specified grade ranges is greater than the total number of scores. Make sure the ranges do not overlap and try again. (This may occur when the grade ranges overlap, and so some grades are counted in multiple ranges) *Hint: You may find it easier to implement step 4 within initFrequency
You should give appropriate prompts for items extracted from the user. No prompts should be given when reading the scores from the specified file. You should print the number of scores in each letter grade range. This is useful to the user and will help you debug your program. Below is a portion of an example session and the final graphical output is given on the next page: Enter the number of possible different grades: 5 Enter the maximum anticipated number of students receiving the same letter grade: 15 Enter the filename containing the scores: asg7.in
For each grade enter the (1) string representing the grade, (2) lowest possible score in that range, and (3) highest possible score in that range.
Grade string: A Lowest possible score: 90 Highest possible score: 100 Number of grades in this range was 5.
... You should modularize your program into functions. Create functions to find the number of grades in a specified range and the number of scores in the file. Below are prototypes you should use for these functions. // Function prototypes - you need to implement void readConfig(int &numGrades, int &maxInGrade, string &filename); int findNumInRange(string filename, int low, int high); void initFrequency(string letters[], int freqLetters[], int numGrades, string filename); void setCurves(sf::RectangleShape bars[],sf::Text labels[], int numGrades); (Note: The template mentions setTheCurves. Either name is fine)
For this assignment, you must use the asg7 project template source from https://github.com/gangryunguh/cop3014-asg7-student-template.git. This project clone can be easily done in CLion - launch CLion and start a asg7 project by check out from Version Control: 1. select "Git" 2. type URL field with https://github.com/gangryunguh/cop3014-asg7- student-template.git 3. type CLion project directory name where you want to place the sample project source
I do not know how to retrieve the data from the website and properly convert over to this text window. Thank You for the help.
|
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started