Find Jobs
Hire Freelancers

Cannibals & Missionaries C++ solution

$30-250 USD

完了済み
投稿日: 10年近く前

$30-250 USD

完了時にお支払い
Cannibals & Missionaries **Problem Description** A particular river crossing is shared by both cannibals and missionaries. A boat is used to cross the river, but it only seats three people, and must always carry a full load. In order to guarantee the safety of the missionaries, you cannot put one missionary and two cannibals in the same boat (because the cannibals would gang up and eat the missionary), but all other combinations are legal. You are to write two procedures: **MissionaryArrives** and **CannibalArrives**, called by a missionary or cannibal when it arrives at the river bank. The procedures arrange the arriving missionaries and cannibals into safe boatloads; once the boat is full, one thread calls *RowBoat* and after the call to *RowBoat*, the three procedures then return. There should also be no undue waiting: missionaries and cannibals should not wait if there are enough of them for a safe boatload. **Please also write a one page design documentation** **The assignment has to be done in Java and Due by 8:59PM, 5/21/2014** ## Deliverables Cannibals & Missionaries **Problem Description** A particular river crossing is shared by both cannibals and missionaries. A boat is used to cross the river, but it only seats three people, and must always carry a full load. In order to guarantee the safety of the missionaries, you cannot put one missionary and two cannibals in the same boat (because the cannibals would gang up and eat the missionary), but all other combinations are legal. You are to write two procedures: **MissionaryArrives** and **CannibalArrives**, called by a missionary or cannibal when it arrives at the river bank. The procedures arrange the arriving missionaries and cannibals into safe boatloads; once the boat is full, one thread calls *RowBoat* and after the call to *RowBoat*, the three procedures then return. There should also be no undue waiting: missionaries and cannibals should not wait if there are enough of them for a safe boatload. **Please also write a one page design documentation** **The assignment has to be done in Java and Due by 11:59AM, Aug-11-03** Common Questions 1. How do we use threads to solve this problem? It's up to you. Remember, a big part of this class is learning how to design code. A lot of these problems have more than one correct solution. Whatever you do, MAKE SURE to tell the grader what you did in your writeup! If the grader doesn't understand what you did, he won't give you any points. L That said, here are some suggestions. One is you can have one thread exist for each Missionary or Cannibal that is there -- in other words, if you have 10 missionaries and 5 cannibals waiting for a boat, there would be 15 threads. Another way you can do it is have a Missionary thread and Cannibal thread; and each one keeps track of how many of its kind of people are waiting -- in this case, there would be 2 threads no matter how many missionaries and cannibals there are. These are just two suggestions. You can do something else if you have a better idea, as long as it involves multiple threads that are communicating via locks and condition variables. (Well, I should say you can do ALMOST anything else... silly solutions will not get points.) Input file and: There is an input file supplied. It will be named **[login to view URL]**. Each line in the file will contain a single request. A request for a Missionary will look like: “Missionary 1??, and a cannibal will look like: “Cannibal 1.?? Essentially it will be the type of passenger, followed by an id number. Output file: The format for the output file should be something like following. "Boat leaving with Missionary 4, Missionary 9, and Cannibal 1!" There should be as many lines printed as the (total number of requests)/3. You should also generate an output file **[login to view URL]** to store your output. ## Platform This assignment must done in C++!!!
プロジェクト ID: 5974691

プロジェクトについて

2個の提案
リモートプロジェクト
アクティブ 10年前

お金を稼ぎたいですか?

Freelancerで入札する利点

予算と期間を設定してください
仕事で報酬を得る
提案をご説明ください
登録して仕事に入札するのは無料です
アワード者:
ユーザーアバター
Hi, I will provide documented code along with build/ run instructions (if needed) Do you have any other restrictions on the platform besides the fact that it has to be written in c++? I'm looking forward to working with you!
$50 USD 1日以内
5.0 (1 レビュー)
0.0
0.0
この仕事に2人のフリーランサーが、平均$58 USDで入札しています
ユーザーアバター
Hi.. I am Nikhil. I have working experience of 3+ year in C and C++Development. I have done many projects on File Handling and you can check my reviews. I am like other freelancer I complete the project on time. I will start work on this from the time you will award me or tell me and will take break when I will done with this. ** I HAVE DONE THIS PROJECT BEFORE ** Please send me message to check my quality.. I have to update this according to your requirements only.. I have used class for this puzzle.. I read your description and understood your requirements. I am very sure that I will do this within 3 to 4 hours. I will write code with comments so you will understand it easily and I will also help you to solve any further query.. Please give me a chance to work with you. Let start conversation so you get to know about my skills and ability. Please give me a chance to do work with you and I am promising you that you will not disappoint by me. If you need any help after project then I will be here. Please give a chance to conversation with you. I am waiting for your positive response. Thank you Very much.
$65 USD 3日以内
4.5 (4 レビュー)
2.4
2.4

クライアントについて

UNITED STATESのフラグ
Los Angeles, United States
5.0
1
メンバー登録日:5月 22, 2014

クライアント確認

ありがとうございます!無料クレジットを受け取るリンクをメールしました。
メールを送信中に問題が発生しました。もう一度お試しください。
登録ユーザー 投稿された仕事の合計
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
プレビューを読み込み中
位置情報へのアクセスが許可されました。
あなたのログインセッションの有効期限がきれ、ログアウトされました。もう一度ログインしてください。