Question
PLEASE HELP ME WRITE THIS IN C! NOT C++ OR ANYTHING ELSE! THANK YOU SO MUCH! PLEASE ONLY USE ONE FUNCTION (NAMED MAIN), SIMPLE ARRAYS,
PLEASE HELP ME WRITE THIS IN C! NOT C++ OR ANYTHING ELSE! THANK YOU SO MUCH!
PLEASE ONLY USE ONE FUNCTION (NAMED MAIN), SIMPLE ARRAYS, AND LOTS OF "IF" LOOPS. THANK YOU!
Objectives:
1. To learn how to use arrays to store and retrieve data to help solving problems.
2. Reinforce use of input files.
Introduction:
Ninja Academy Ninjas are awesome! Your friend has not stopped talking about how cool ninjas and how they would like to become a ninja. To amuse your friend, you have decided to create a series of programs about ninjas.
Problem: Advancing to Masterclass (ninjaadvancement.c)
It is time for your friend to complete their assesment for the first level of ninja education!
Only a few of the ninja students will be permitted into the advanced courses at the Ninja Academy.
In addition to completing the assessments themselves, your friend is responsible for figuring out if they will be able to advance. All the scores of all the students will be grouped into a single parchment. Your friend will not know which other students have which scores; they will only know their own score.
To help your friend out, you will build a menu driven program that allows them to:
1. Calculate the average assessment score for a subset of the scores.
2. Calculate the minimum assessment score for a subset of the scores.
3. Calculate the maximum assessment score for a subset of the scores.
4. Calculate the number of assessment scores exceeding the users score.
5. Calculate what percentage of the assessment scores are under the users score.
6. Determine how many other students scored the same as the user.
7. Determine if the user will be able to advance.
8. Quit
Your program should allow the user to continue choosing these options and execute them until the user quits.
Input File Format:
The first line of the input file will contain a single integer n (5 n 10000), denoting the number of student scores listed in the file. Each score follows, one per line. Each score will be a positive integer less than or equal to 1800. (This is the maximum possible score for ninja evaluations.)
Note: The entire time the program is running, it will be making these queries on the same set of data that was originally read it at the beginning of the program.
Output Specification:
At the very beginning of your program, you should prompt the user for their input file and their personal assesment score. Once that is read in, your program should print out a message with the following format: The scores for X students of the Ninja Academy have been read. where X represents the total number of scores read from the file. These scores are numbered from 0 to X - 1.
Here is what your program should do for each of the following options:
#1. Prompt the user for the low bound for the subset of scores and the high bound for the subset of scores (you may assume that the user enters valid numbers). Then produce an output message with the following format: The average score from student A to student B is X.XX. where A is the low bound entered by the user, B is the high bound entered by the user and X.XX represents the average score (rounded to two decimal places) of the group of students from student A to student B, inclusive.
#2. Prompt the user for the low bound for the subset of scores and the high bound for the subset of scores (you may assume that the user enters valid numbers). Then produce an output message with the following format: The lowest score from student A to student B is X. where A is the low bound entered by the user, B is the high bound entered by the user and X represents the smallest score within the group of students from student A to student B, inclusive.
#3. Prompt the user for the low bound for the subset of scores and the high bound for the subset of scores (you may assume that the user enters valid numbers). Then produce an output message with the following format: The highest score from student A to student B is X. where A is the low bound entered by the user, B is the high bound entered by the user and X represents the highest score within the group of students from student A to student B, inclusive.
#4. Using the score the user entered at the beginning of the program, print out a message with the following format: X students scored higher than you. where X represents the total number of scores (from the whole file) that exceed the users score.
#5. Using the score the user entered at the beginning of the program, print out a message with the following format: X.XX percent of students scored lower than you. where X.XX represents the percentage of scores out of all of the scores (from the whole file) that are lower than the users score.
#6. Using the score the user entered at the beginning of the program, print out a message with the following format: X students scored the same as you. where X represents the total number of scores (from the whole file) that match the users score.
#7. First, prompt the user for the number of students that will be permitted to advance. Using the score the user entered at the beginning of the program, determine if the users score is high enough compared to the other scores to advance. Then print out one of the following messages: You will be able to advance to the master class! Or You will not be able to advance.
Program Specification:
You must use arrays to solve the problem. Your program should first prompt the user for the name of the input file and the users assessment score. Then, store all the values from the file into an array for processing. Continue to print the menu and process options until the user selects quit. If the user enters an invalid option, print the following error message and then reprint the menu. Sorry, that was not a valid option.
Input/Output Sample(s):
Sample input and output files will be provided below:
Sample input:
100 595 448 947 1747 1240 189 286 1559 1733 1539 473 270 516 1478 241 560 1430 1657 1415 654 775 781 619 1623 322 91 260 1196 557 1660 850 1082 364 346 1508 1698 1593 928 190 1123 909 47 422 467 1584 1293 467 179 104 1503 1376 465 620 75 1500 27 513 446 898 446 1800 287 1637 826 1147 484 149 1398 626 1392 1363 545 470 982 1210 810 1372 266 71 1048 1225 640 387 109 1711 1247 760 1703 1573 1524 599 1015 22 1233 190 698 1552 278 1716 253
Sample output:
What is the name of the input file? ninjascores.txt What did you score on your assessment? 1600 The scores for 100 students of the Ninja Academy have been read.
What would you like to do? 1. Calculate the average assessment score for a subset of the scores. 2. Calculate the minimum assessment score for a subset of the scores. 3. Calculate the maximum assessment score for a subset of the scores. 4. Calculate the number of assessment scores exceeding the user's score. 5. Calculate what percentage of the assessment scores are under the user's score. 6. Determine how many other students scored the same as the user. 7. Determine if the user will be able to advance. 8. Quit 1 What is the lower bound? 2 What is the upper bound? 50
The average score from student 2 to student 50 is 894.92.
What would you like to do? 1. Calculate the average assessment score for a subset of the scores. 2. Calculate the minimum assessment score for a subset of the scores. 3. Calculate the maximum assessment score for a subset of the scores. 4. Calculate the number of assessment scores exceeding the user's score. 5. Calculate what percentage of the assessment scores are under the user's score. 6. Determine how many other students scored the same as the user. 7. Determine if the user will be able to advance. 8. Quit 1 What is the lower bound? 0 What is the upper bound? 99
The average score from student 0 to student 99 is 862.02.
What would you like to do? 1. Calculate the average assessment score for a subset of the scores. 2. Calculate the minimum assessment score for a subset of the scores. 3. Calculate the maximum assessment score for a subset of the scores. 4. Calculate the number of assessment scores exceeding the user's score. 5. Calculate what percentage of the assessment scores are under the user's score. 6. Determine how many other students scored the same as the user. 7. Determine if the user will be able to advance. 8. Quit 2 What is the lower bound? 0 What is the upper bound? 99
The lowest score from student 0 to student 99 is 22.
What would you like to do? 1. Calculate the average assessment score for a subset of the scores. 2. Calculate the minimum assessment score for a subset of the scores. 3. Calculate the maximum assessment score for a subset of the scores. 4. Calculate the number of assessment scores exceeding the user's score. 5. Calculate what percentage of the assessment scores are under the user's score. 6. Determine how many other students scored the same as the user. 7. Determine if the user will be able to advance. 8. Quit 2 What is the lower bound? 50 What is the upper bound? 75
The lowest score from student 50 to student 75 is 27.
What would you like to do? 1. Calculate the average assessment score for a subset of the scores. 2. Calculate the minimum assessment score for a subset of the scores. 3. Calculate the maximum assessment score for a subset of the scores. 4. Calculate the number of assessment scores exceeding the user's score. 5. Calculate what percentage of the assessment scores are under the user's score. 6. Determine how many other students scored the same as the user. 7. Determine if the user will be able to advance. 8. Quit 3 What is the lower bound? 0 What is the upper bound? 99
The highest score from student 0 to student 99 is 1800.
What would you like to do? 1. Calculate the average assessment score for a subset of the scores. 2. Calculate the minimum assessment score for a subset of the scores. 3. Calculate the maximum assessment score for a subset of the scores. 4. Calculate the number of assessment scores exceeding the user's score. 5. Calculate what percentage of the assessment scores are under the user's score. 6. Determine how many other students scored the same as the user. 7. Determine if the user will be able to advance. 8. Quit 3 What is the lower bound? 0 What is the upper bound? 9
The highest score from student 0 to student 9 is 1747.
What would you like to do? 1. Calculate the average assessment score for a subset of the scores. 2. Calculate the minimum assessment score for a subset of the scores. 3. Calculate the maximum assessment score for a subset of the scores. 4. Calculate the number of assessment scores exceeding the user's score. 5. Calculate what percentage of the assessment scores are under the user's score. 6. Determine how many other students scored the same as the user. 7. Determine if the user will be able to advance. 8. Quit 4
11 students scored higher than you.
What would you like to do? 1. Calculate the average assessment score for a subset of the scores. 2. Calculate the minimum assessment score for a subset of the scores. 3. Calculate the maximum assessment score for a subset of the scores. 4. Calculate the number of assessment scores exceeding the user's score. 5. Calculate what percentage of the assessment scores are under the user's score. 6. Determine how many other students scored the same as the user. 7. Determine if the user will be able to advance. 8. Quit 5
89.00 percent of students scored lower than you.
What would you like to do? 1. Calculate the average assessment score for a subset of the scores. 2. Calculate the minimum assessment score for a subset of the scores. 3. Calculate the maximum assessment score for a subset of the scores. 4. Calculate the number of assessment scores exceeding the user's score. 5. Calculate what percentage of the assessment scores are under the user's score. 6. Determine how many other students scored the same as the user. 7. Determine if the user will be able to advance. 8. Quit 6
0 students scored the same as you.
What would you like to do? 1. Calculate the average assessment score for a subset of the scores. 2. Calculate the minimum assessment score for a subset of the scores. 3. Calculate the maximum assessment score for a subset of the scores. 4. Calculate the number of assessment scores exceeding the user's score. 5. Calculate what percentage of the assessment scores are under the user's score. 6. Determine how many other students scored the same as the user. 7. Determine if the user will be able to advance. 8. Quit 7 How many students will be advancing? 5 You will not be able to advance.
What would you like to do? 1. Calculate the average assessment score for a subset of the scores. 2. Calculate the minimum assessment score for a subset of the scores. 3. Calculate the maximum assessment score for a subset of the scores. 4. Calculate the number of assessment scores exceeding the user's score. 5. Calculate what percentage of the assessment scores are under the user's score. 6. Determine how many other students scored the same as the user. 7. Determine if the user will be able to advance. 8. Quit 7 How many students will be advancing? 12 You will be able to advance to the master class!
What would you like to do? 1. Calculate the average assessment score for a subset of the scores. 2. Calculate the minimum assessment score for a subset of the scores. 3. Calculate the maximum assessment score for a subset of the scores. 4. Calculate the number of assessment scores exceeding the user's score. 5. Calculate what percentage of the assessment scores are under the user's score. 6. Determine how many other students scored the same as the user. 7. Determine if the user will be able to advance. 8. Quit
8
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