$39
Objectives
Introduction: Mission to Mars
Your friend has been playing a new Mars Colony simulator nonstop! They are always talking about how cool it would be if they could be a on the first real-life mission to Mars! To amuse your friend, you have decided to create a series of programs about the possible first colony on Mars.
Problem: Autonomous Robot Selection (marsrobots.c)
For our first mission to Mars, we will send only autonomous robots to set up our colony. Our robot development team has recently contacted us to say that they have numerous types of robots with different attributes to choose from. We now need to decide what we will prioritize in our robots:
In this program we want to read information from a file about the robots we could potentially send to Mars. Ask the user for the name of this file and process the file they specify.
For each robot, we will have a manufacturing number, a cost, an efficiency rating, and an expected battery life in hours. After we have read all the information, we want to print out which robot – identified by manufacturing number – will be best for each criterion.
If a single robot has the best rating for 2 or more attributes, we should recommend it above all the other options.
Input Specification
1. The file name will be a string less than 50 characters in length
Input File Format
The first line of the input file will contain a single integer n (5 ≤ n ≤ 10000), denoting the number of potential robots, for which information is listed in the file. The following n lines will have all the information for all the robots with one robot's information on a single line. Each line will have the following format:
ManufacturingID Cost EfficiencyRating BatteryLife
ManufacturingID
will be a positive integer representing the robot type.
Cost
will be a positive real number representing the price for each unit
EfficiencyRating
will be a positive real number representing the efficiency rating
BatteryLife
will be a positive real number representing the expected battery life
Output Specification
Output to the screen. Show the user the best robot – identified by manufacturing number – for each attribute.
Attribute |
Best Option |
Best Value |
Cost |
A |
X.XX |
Efficiency |
B |
Y.YY |
Battery |
C |
Z.ZZ |
Where A is manufacturing ID of the robot with the best cost and X.XX is the best cost available, B is the manufacturing ID of the robot with the best efficiency rating and Y.YY is the best efficiency rating available, and C is the manufacturing ID of the robot with the best battery life and Z.ZZ is the best battery life available.
If a single robot has the best rating for 2 or more attributes, we should recommend it above all the other options. This is not guaranteed to happen, but is a possibility to consider:
Robot H has the best rating in 2 or more attributes!
Input/Output Sample(s)
Sample input and output files will be provided on the webcourse.
Acceptable Resources
Remember, the use of online help sites is strictly prohibited. The only acceptable resources for these assignments are below:
Style Notes
Please review the course Style Guide on the webcourse, with special attention to the following notes:
Deliverables
One source file: marsrobots.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: