Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment #6 Introduction to C Programming COP 3223 Objectives 1. To learn how to use arrays to store and retrieve data to help solving problems.

Assignment #6 Introduction to C Programming COP 3223 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: Mentorship (ninjamentors.c) It is time for your friend to select their ninja mentors! Ninja students are able to select several mentors from the class of higher level students to learn special skills from. Skills are categorized as Stealth (S), Combat (C), and Agility (A). Your friend will be provided with a file of older students that has their name and rankings for the different skills. They can then choose 5 mentors to learn from. To assist, your program should read in all of the students information and print out the two best combat mentors, the two best stealth mentors, and the best agility mentor. If your friend has been a diligent student, they will be able to select these best options! If not, they will need to go down the list and select other mentors. Combat Skills are split into Hand to Hand and Distance. Stealth skills are split into Observation and Concealment. Agility is a singular category. Input File Format The first line of the input file will contain a single integer n (5 n 100), denoting the number of potential mentors, for which information is listed in the file. The following n lines will have all the information for all the mentors with one mentor's information on a single line. Each line will have the following format: ID Category HandCombatPts DistanceCombatPts ObservationPts ConcealPts AgilityPts ID will be a positive integer representing the potential mentor. Category will be a single character, either 'C', 'S' or 'A', for combat, stealth or agility, respectively. HandCombatPts will be an integer representing the number of points that student was given last year by their hand to hand combat instructor. DistanceCombatPts will be an integer representing the number of points that student was given last year by their distance combat instructor. ObservationPts will be an integer representing the number of points that student was given last year by their observation and spying skills instructor.

ConcealPts will be an integer representing the number of points that student was given last year by their concealment and disguise instructor. AgilityPts will be an integer representing the number of points that student was given last year by their agility and acrobatics instructor. How to Compute a Ranking For each potential mentor, their ranking will be a summation weighted by their category. If they are a potential combat mentor their ranking should be: (HandCombatPts*5 + DistanceCombatPts*5 + ObservationPts + ConcealPts + AgilityPts*2)/10 If they are a potential stealth mentor their ranking should be: (HandCombatPts + DistanceCombatPts + ObservationPts*5 + ConcealPts*5 + AgilityPts*2)/10 If they are a potential agility mentor their ranking should be: (HandCombatPts + DistanceCombatPts*2 + ObservationPts*2 + ConcealPts + AgilityPts*5)/10 Program Specification You must use arrays to solve the problem. Your program should first prompt the user for the name of the input file. Then, your program should process the input file and write the five best mentors for your friend. Each line should list the category, the ID, and the ranking of the mentor, respectively, separated by spaces. Round the ranking to two decimal places. The mentors must be listed according to category as follows: agility, followed by the two combat, followed by the two stealth. Both the combat and the stealth mentors must be listed in descending order of ranking. Output Sample Sample outputs will be provided on the webcourse. Deliverables One source file: ninjamentors.c for your solution to the given problem submitted over WebCourses. Restrictions Although you may use other compilers, your program must compile and run using Code::Blocks. Your program should include a header comment with the following information: your name, course number, section number, assignment title, and date. Also, make sure you include comments throughout your code describing the major steps in solving the problem. Grading Details Your programs will be graded upon the following criteria: 1) Your correctness

2) Your programming style and use of white space. Even if you have a plan and your program works perfectly, if your programming style is poor or your use of white space is poor, you could get 10% or 15% deducted from your grade. 3) Compatibility You must submit C source files that can be compiled and executed in a standard C Development Environment. If your program does not compile, you will get a sizable deduction from your grade.

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

For the INPUT:

10 14 A 447 252 68 34 978 2 C 230 299 597 180 9 27 A 318 220 97 28 1317 32 C 563 450 547 112 28 8 C 669 260 200 36 171 11 S 179 45 1342 732 174 19 S 74 249 861 1165 6 21 A 757 240 97 119 2032 15 S 275 177 588 577 52 6 C 886 401 327 109 48

And the output one should get is:

A: 21 1171.00 C: 6 696.70 C: 32 578.00 S: 11 1094.20 S: 19 1046.50

This question was asked before but not answered correctly so can someone please help me out thank you.

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

Larry Ellison Database Genius Of Oracle

Authors: Craig Peters

1st Edition

0766019748, 978-0766019744

More Books

Students also viewed these Databases questions