COP 3223 Introduction to C   Assignment 3.RAR

COP 3223 Introduction to C Assignment 3

This assignment is worth a maximum of 75 points Objectives: The purpose of this assignment, is for students to demonstrate knowledge of x the basic template of a simple C program x correct syntax of the if conditional statements x semantics of if statements in C x how to declare appropriate variable types to store program data x how to use simple C syntax and semantics to create a program that compiles and runs correctly x use of comments to annotate code Problem: Your family frequently spends the day at magic kingdom. The last hour is often wasted just trying to figure out which rides should be visited to make the best of the remaining time. In the end, you often just decide choose a random ride even if it is not really one that you like. You have plans to visit Disney this weekend, since your family will have visitors from out of town. You do not want the last hour to spoil their memories of the day, so you have decided to create an app which can select the rides to visit to make the most efficient use of the last hour. Your app will prompt a user for the wait times for each of 5 rides. The wait times will be given as a whole number of minutes. Assuming that wait times will not change within the hour and every ride runs for exactly 2 minutes, find the maximum number of rides that will make the best use of your time. You may not go over the 60 minutes but you should make the most possible use of the time. This means that you should have the minimum amount of time over. You may also assume that the time taken to walk from a ride to another is 3 minutes. When run, your program should output the rides that should be selected. The total number of the last 60 minutes used. Submission of Assignment Your assignment should be submitted via Webcourses by the deadline. No assignments will be accepted via email. Your submission should include a single .c file called rides.c . Remember that your program will be graded using DevC++ , so be sure that your submitted code runs correctly in this IDE. If you do not have DevC++ on your personal machine, you may use a computer in any lab to test your code. 1 Restrictions: Please ensure that your program outputs the exact text as in the sample run. Naturally the numeric values will be different, depending on the input used. However the text of the output should be the same. You may assume that: x the user always enters valid data. x the wait times are in whole minutes x there is only 1 best combination of rides Below is sample output that would be produced when your program is run. The blue text is the user input Sample run 1 of rides.c Please enter the wait times for the 5 rides that you are interested in riding 10 5 12 8 15 You can ride the following rides: 2 3 4 and 5 That will use up 60 minutes of your time Sample run 2 of rides.c Please enter the wait times for the 5 rides that you are interested in riding 15 11 20 0 13 You can ride the following rides: 1,2,4, and 5. That will use up 59 minutes of your time
Powered by