Find Jobs
Hire Freelancers

C++ Homework help

$2-8 USD / hour

已取消
已发布将近 7 年前

$2-8 USD / hour

Design an object-oriented fishing game using the following two classes as specified in Unified Modeling Language (UML).  + indicates public, - indicates private, and the data type of a return value or a parameter is indicated by a : following its name. Fish - name : string /> - value : int + Fish(): + Fish(name:string, value:int): + setName(name:string):void + setValue(value:int):void + getName() : string + getValue() : int Player - inventory : Fish* - numFish : int + Player(): + ~Player(): + goFish() : void + addFish(fish : Fish) : void + getTotalScore() : void + printInventory() : void + sortInventory() : void Each Fish object will have a name and a point value associated with it.   It will have a getName() and getValue() function to access its private variables. It will have a setName() and setValue() function to mutate its private variables. It will have a default constructor for when the array is first created. It will have a constructor that takes a name and value for when a new Fish is created and added to the array. The Player object will hold: inventory, a pointer to a dynamically allocated array of Fish objects.    numFish will hold the number of fish in the array, initially 0.  The default constructor will create each of these initial values. The destructor will delete the Fish array using delete [] goFish() : void Create a 1 in 4 chance that a fish will be caught If a fish is caught, create 1 of 5 randomly selected fish objects: Make a common fish, 60/100 times will be caught Another fish is 20 / 100 Next, 14 / 100 Next 5 / 100 Finally, 1 / 100, an ultra rare fish Give each of the 5 fish types their own name, and a value that corresponds to its rarity Once the fish is caught and its type decided, call addFish() with the newly constructed fish object as its argument If the user caught a fish, notify them of its name and value, otherwise say they didn't catch anything. addFish(fish : Fish) : void increment numFish by 1 allocate a new temporary array with size equal to numFish Copy all of the fish from inventory to the temp array Assign the new fish to the end of the temp array delete[] the inventory pointer to free up the old array Assign the inventory pointer to equal the address of the temp array getTotalScore() : void Output total sum of the value of the fishies printInventory() : void Output the names and point values of each fish.  Use iomanip to make it into a nice two column table. sortInventory() : void Sort the fish inventory by name.  Hint : look at the name for comparison, but swap the entire object when swapping. Create an outer game loop that repeatedly asks the user if they would like to go fishing (y or n), then call goFish(), then sortInventory(), then printInventory(), then getTotalScore(). You can write the class definitions and main all in one file if you choose to.  If you place your class declarations in header files and class definitions in separate cpp files, make sure you submit the entire project folder as a zip.
项目 ID: 13907521

关于此项目

9提案
远程项目
活跃7 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
9威客以平均价$5 USD/小时来参与此工作竞价
用户头像
Hi, I hope you will be doing well. I believe on perfect work with 100% satisfaction of my client then payment. I deliver only exceptionally robust and well-designed work as a rule to my client. I understand your project and I am confident that I can do your project with great accuracy and 100% efficiency. I have seven years programming/teaching experience in Java/ C++/ C/Matlab/Software Architecture/ C#/Algorithm Design and Analysis. I am software developer and providing software solutions to my client from last seven years. I will provide you quality work with 100% accuracy. I want to do best to best work for my client, gain 100% satisfaction and quality work. You can trust me and consider me for your project. I am also faculty member (Instructor) at Computer Science and Engineering Department in FAST-NUCES National University Pakistan since February 2013. Thanks! Best Regards, Engr. Shahi
$6 USD 在10天之内
4.7 (42条评论)
4.9
4.9
用户头像
Hi David here, I hope you will consider me for your project. I will assure you a quality end product at a competitive price. I know you will be swamped with bids so thank you for the time. Hoping to hear from you soon and if you have any queries please do not hesitate to message me and i can talk. thanks
$5 USD 在40天之内
0.0 (0条评论)
0.0
0.0
用户头像
A proposal has not yet been provided
$4 USD 在5天之内
0.0 (0条评论)
0.0
0.0

关于客户

UNITED STATES的国旗
United States
0.0
0
会员自5月 2, 2017起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。