Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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. Jack doesn't want to divvy up the plunder just yet, so he gives each man in the crew other than himself and the first mate Mr. Gibbs 3 pieces of gold and sends them into town to celebrate. After the crew has gone, he and Gibbs count what's left and decide how to split it up among the crew. Jack takes 12% of the gold, which he counts out and hides in his cabin. Jack gives Gibbs 8% of the remaining gold, which Gibbs counts out and counts out and hides in his cabin. The next morning, the remaining gold is divided evenly among the members of the crew, including Jack and Gibbs. Little do they know that Cap'n Jack and Mr. Gibbs 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 Fund (PBF).

The problem is to compute how much gold each person gets and how how much goes to the PBF. 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, but don't lose any gold from the overall total amount.

Your program should work for any reasonable set of inputs. It should ask a 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 Jack and Mr. Gibbs

The program should then split the gold and print out

  • Jack's share
  • Gibb's share
  • The Crew share
  • PBF Amount

Here's an example interaction showing user input and output:

Number of Pirates: 20 Number of gold coins: 1000 Jack's share: 151 Gibb's share: 104 Crew: 38 PBF: 7

*the code should be written in Python.

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

Databases And Information Systems 1 International Baltic Conference Dbandis 2020 Tallinn Estonia June 19 2020 Proceedings

Authors: Tarmo Robal ,Hele-Mai Haav ,Jaan Penjam ,Raimundas Matulevicius

1st Edition

303057671X, 978-3030576714

More Books

Students also viewed these Databases questions