Madison P
2011-02-04 18:28:48 UTC
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.
Your program should ask the user for two pieces of information:
* How much gold the pirate ship came into port with, and
* How many pirates are on the ship, including Captain Jack and the first mate.
Your program will then calculate and print how much gold the captain gets, how much the first mate gets, and how much each of the rest of the crew get. Finally, print out how much goes to the Pirate's Benevolent fund.
So I was able to calculate Jack's and the first mate's share, but when I got to the crew and the Pirate's Benevolent fund, I am stumped. Please help.