COP 3223! Introduction: Pirate Time Your friend has not stopped talking about how cool pirates and how awesome it would be if they could be
COP 3223!
Introduction: Pirate Time Your friend has not stopped talking about how cool pirates and how awesome it would be if they could be a real-life pirate captain! To amuse your friend, you have decided to create a series of programs about pirates.
Problem: Preparing to Leave Everyone knows that the best pirates sail the Caribbean, but theres one problem! Your friend is located in Spain. Plenty of other pirate captains have made the trans-atlantic trip and your friend can to. In this program, we will calculate how long it will take your friend to reach the Caribbean and how many oranges they need to stay healthy along the way. You will need to ask the user how many kilometers they can travel in their ship in one day. You can then determine how many days it will take them to reach their destination. The distance from Spain to the Caribbean is 7,228 kilometers. Then, ask how many crew members the ship can hold. Everyone knows scurvy is the main risk when traveling the ocean and your friend will need half an orange (.5) per crew member per day to make it safely. Calculate how many oranges this is and print this information to the user. Remember, values that do not change (like the distance from Spain to the Caribbean) should be declared as constants in your program.
Input Specification 1. The distance in kilometers per day will be a positive integer. 2. The number of crew members will be a positive integer. Output Specification Output the number of oranges needed as a real number using the format below: You will need X.XX oranges to make the trip!
Output Sample Below are some sample outputs of running the program. Note that these samples are NOT a comprehensive test. You should test your program with different data than is shown here based on the specifications given above. In the sample run below, for clarity and ease of reading, the user input is given in italics while the program output is in bold. (Note: When you actually run your program no bold or italics should appear at all. These are simply used in this description for claritys sake.) Sample Run #1 How many kilometers can your ship travel in one day? 500 How many crew members can your ship hold? 20 You will need 144.56 oranges to make the trip! Sample Run #2 How many kilometers can your ship travel in one day? 100 How many crew members can your ship hold? 15 You will need 542.10 oranges to make the trip! Deliverables One source file pirateprep.c is to be 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.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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