$29
Objective of this assignment is to apply OOP concept learned in the class. You need to read a book.txtfile
Every line in the file have book name,ID,genre,rating. Everything is comma separated
There are three types of genre
fiction
poetry
horror
Rating is always an integer type. But ID type differs in each category. For Fiction, ID is string type, For Poetry, ID is an integer type and For Horror, ID is float type.
Note: to convert from string to float, we use stof()
Task 1: You need to create a class Book and inherit three genres of book.
Then you need to output all the details of Books with top 10 rated from each category.
At the end output overall top 10 rated Book.
For example, Your output would be:
cout<<”Top 10 for Genre Fiction are:”<<endl;
..
…
cout<<”Top 10 for Genre Poetry are:”<<endl;
..
…
cout<<”Top 10 for Genre Horror are:”<<endl;
…
..
cout<<”Top 10 for all the genres are:”<<endl;
…
……..
Task 2 Draw a Class Diagram: Refer to drawing and explanation below
In software engineering, a class diagram is a type of static structure diagram that describes the structure of a system by showing the system's classes, their attributes, methods and the relationships among objects.
For Example:
In the above diagram
Animal is a Base class. Duck, Fish and Zebra is derived class.
We point arrow from derived class to the base class
Each class is represented in the form of box. Box is divided into 3 parts. Upper part have class name. Middle part have variable name and its type. And third part have methods.
The ‘+’ or ‘-’ sign represent access specifiers of the variables
• Public
• Private
• Protected
Draw class diagram for your code.
Note: You need to apply sorting to get top 10 results (refer to chapter 4 on sorting of visualizing data structures)
Your main function will first read the initial book details from a file and store it in arrays. Do not post answers on piazza this time.
What is needed?
Use Inheritance taught in last week's lecture. Base class here should be Book. There is no restriction on how your code works as long as you are using classes and inheritance.
Before you start coding
Write the pseudocode for your program. There are a lot of details needed in this program that are not explicitly outlined in this write-up. If you just start coding before thinking through the problem, you might spend a lot of time re-doing your work.
Submitting Your Code:
Submit your assignment to Canvas
You can use any software to make class diagram or even make it on paper clearly and click picture.Diagram should be visible. Zip together your class diagram and .cpp file. Submit the
.zip file through Canvas. Remember if you only submit one task, you will not get marks on the other task.
Make sure your code is commented enough to describe what it is doing. Include a comment block at the top of the .cpp file with your name, assignment number.