Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Assignment #2 Introduction to C Programming COP 3223 Objectives 1. To give students practice at typing in, compiling and running simple programs. 2. To reinforce

Assignment #2

Introduction to C Programming COP 3223

Objectives 1. To give students practice at typing in, compiling and running simple programs. 2. To reinforce knowledge of assignment statements and arithmetic expressions 3. To learn how to use if statements for conditional execution.

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: Crew Recruitment Before your friend can set sail, they will need a crew to sail with. Your friend has created a special series of questions to determine an applicants suitability for sailing the ocean and looking for treasure in the Caribbean. Based on their answers the program should print whether or not they will be allowed to join the crew. They will be asked two questions: 1. Do you like digging for treasure? 2. Are you able to swim? If the user indicates yes to the second question, the program should ask them how far they can swim in meters. Based on these responses, you will need to determine if they will be a good crew member for the ship. If the user does not enjoy digging for treasure, they will not make a good pirate. If the user cannot swim at least 100 meters, they should not attempt to sail the ocean. Otherwise, you can allow them to join your crew! Input Specification 1. The answer to each of the two questions will be either Y to indicate yes or N to indicate no. 2. The answer to the number of swimming meters will be an integer >= 0.

Output Specification The output should be a single line that tells the user whether or not they will be allowed to join the crew. You may join the pirate crew! Arrr! Or: You may not join the crew.

2 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 Do you like digging for treasure? Y Are you able to swim? Y How many meters are you able to swim? 150 You may join the pirate crew! Arrr!

Sample Run #2 Do you like digging for treasure? Y Are you able to swim? Y How many meters are you able to swim? 15 You may not join the crew.

Sample Run #3 Do you like digging for treasure? N Are you able to swim? Y How many meters are you able to swim? 150 You may not join the crew.

Sample Run #4 Do you like digging for treasure? N Are you able to swim? N You may not join the crew.

Deliverables One source files piratecrew.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, 3 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.

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

More Books

Students also viewed these Databases questions