CS 1400 Fundamentals of Programming

Programming Project 2: Captain Jack


At the completion of this project, you will have created an application that

The problem

Captain Jack and his crew of pirates arrive in Tortuga after several weeks of plundering the high seas. Since the crew has been at sea for nearly a month, they are ready for a night of celebration. Captain Jack doesn't want to divvy up the treasure just yet, so he gives each man in the crew (except for himself and the first mate) 3 pieces of gold and sends them into town to celebrate. After the crew has gone he and the first mate count what's left and decide how to split it up among the crew. Captain Jack decides that he'll take 12% of the gold. He counts out his gold and hides it in his cabin. The Captain agrees to give the first mate 8% of the remaining gold. The first mate counts out his coins and hides it in his cabin. The next morning, the gold that is left is divided evenly among the members of the crew, including Captain Jack and the First Mate. Little do they know that Cap'n Jack and the first mate have already taken a cut. If the remaining treasure can't be split evenly, the bits that are left over are given to the Pirate's Benevolent Association.

The problem is to compute how much gold each person gets, and if any, how much goes to the Pirate's Benevolent Association. Keep in mind that a piece of gold cannot be split, so if some calculation yields a number that contains a fractional part, you can only give that person the integer part of the value. For example, if your program computed the captain's share as 25.67 pieces of gold, you could only give him 25 pieces of gold, not 25.67 pieces of gold. Warning, when you do any calculations do not round up. Simply drop the fractional part.

The Interface


You should design your own interface for this problem. It need not look like the one shown here, but it must contain the required information.

Your interface should have a menu strip with a menu item for exiting the application and one for showing your about box.

The interface should also have the following Text Boxes, appropriately labeled:

Finally, add a button that will cause these calculations to be performed.


Your program should ask the user for two pieces of information:

Your program should work for any reasonable set of inputs. Here is an example of what your program should produce.

With 20 pirates and 1000 pieces of gold:
Captain Jack113 gold coins (151 if you count the 38 everyone in the crew gets)
First Mate66 gold coins (104 if you count the 38 coins everyone in the crew gets)
The Crew38 gold coins each (don't count the 3 coins each took into town)
The PBA7 gold coins

Writing the Code

Create Event handlers for the exit menu item, the about menu item, and for the button. Before you fill in the code for the button's event handler, write the pseudo-code that you need to explain how the calculations to divide up the gold should work. Put this pseudo-code inside the curly braces for the button's event handler. This is where most of the action will take place in your program. Now fill in the actual code statements that do what your pseudo-code asked for.

Format and document your code in accordance with the course style guidelines.  Include a file prologue identifying you as the author. Be sure that you have complete method prologues on each method. Be sure that you have no magic numbers in your code. Submit your project using the instructions outlined in the Course Syllabus, Programming Projects section.

File(s) to Submit:

Place your complete project folder into a zip file and name the zip file
proj_02_your-initials_V1.0.zip. For example, I would name my file proj_02_RKD_V1.0.zip. Submit this assignment as Project #2 on Canvas.

Grading Criteria

Description Points possible Your points

Project meets the following guidelines:
o Source code files contain a declaration that you did not copy any code
o Project has been properly submitted to Canvas
o Code meets style guidelines
o Code is properly documented
o Code contains no magic numbers


Your program provides a graphical user interface similar to the one shown. It contains working Exit and and About menu items. Your interface us inituitive and easy to use.


When the user fills in the number of pirates and the number of gold pieces, and clicks on the button, your program correctly divides the gold, according to the specifications.


Early bonus (+3 pts) or late penalty (20%/day)




Sample Executable

You can get an executable that runs correctly here!