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.
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
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