Assignment #7 Introduction to C Programming – COP 3223

$30.00

Category: You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (8 votes)

Objectives
1. To learn how to write functions given specifications
2. To learn how to the use pass by value and pass by reference variables
3. Review previous concepts like if-statements and loops.
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: Ocean Voyage (oceanvoyage.c)
Armed with the map from the Old Pirate’s Treasure Chest, plenty of oranges, and the best landing crew
possible, your friend is ready to depart Spain for the Caribbean in search of treasure. The trip will be long
and dangerous.
Your friend must decide how they will travel: as a merchant, as a privateer, or as a pirate. Merchant
vessels are fairly safe, but slow. Merchant sailors will be given extra gold for their journey from their
investors at home. Privateer vessels are well armed and a bit faster. Financed by the government,
privateers will also receive a little extra gold for the trip. Pirates have the fastest ships in the seas, but
only have the gold they already possess.
As captain, your friend has decided to depart from Port Marin, Spain. They will travel along the coast of
Spain and Portugal and make for the Canary Islands. They will be able to buy supplies in both of these
ports. From the Canary Islands they can catch the trade winds to Grenada at the edge of the Caribbean
Sea. This will be the last opportunity to get supplies before searching for the island on the Old Pirate’s
map.
Between ports there are many dangers. Sailors may fall ill, storms and fog may plague the ship, and parts
of the ship may even break down. These will cause delays and your friend must balance the need to get
to the treasure with the need to keep their crew healthy. Make sure they purchase plenty of food and
extra parts for the journey.
At the end of the journey your friend will note how many of the crew survived the trip and how many
shovels they managed to bring to dig up the treasure.
A skeleton of the solution for this assignment is posted on the webcourse. You must fill in the functions
that are currently empty. After you write each function, you should test it before moving on. The main
function should not be modified for the final submission (you may modify it during testing, as long as you
return it to its initial form).
Descriptions of each function are given in the skeleton along with the function Pre- and Post-conditions.
Output samples are available on the webcourse as well. These show the wording you should use and how
the program should run when completed. Points are allotted for following the precise wording shown.
Deliverables
One source file: oceanvoyage.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.