I am writing a program that requires a 1.Class specification file (header file),
ID: 3659391 • Letter: I
Question
I am writing a program that requires a 1.Class specification file (header file), 2. a Implementation File and 3. a main file I have finished writing my 1. Class Specification file and 2. Implementation file. I have stared my main file but I dont know how to finish it can someone help me finish it. I have posted the assignment below and my codes below.
**************Assignment**********
Book Store Program
You would like to write a program that functions similarly to a book store data base. Your program should read book data
from an inventory file called books.dat that contains best selling book titles, prices, and number of copies. Your program
should store this data in a linked list (each node will contain a title, price, copies, and link to another node).
Your program should allow a user (book store owner) to do several things:
* Type in a title and retrieve the number of copies available.
* Find titles that need to be reordered - this should be done if the number of copies is less than 10.
* Delete a book and its inventory
* Print the book titles in order of price (least to greatest)
* print the list of inventory (all fields).
Add each routine individually and test it before going on to another routine.
************* 1. My Class specification file (header file)******
#include < string>
using namespace std;
class Store
{
private:
string title;
int reorder;
int delete;
double bookprices;
public:
int numOfCopies(string title);
void FindTitleReoreder();
void DeleteBook(int delete);
void PrintBookPrices();
void PrintAll();
};
*************** 2. Implementation file********
#include "Store.h"
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
/*
private:
string title;
int reorder;
int delete;
double bookprices;
*/
int Store::numOfCopies(string title)
{
return();
}
void Store::FindTitleReoreder()
{
reutrn(reorder);
}
void Store::DeleteBook(int delete)
{
return(delete);
}
void Store::PrintBookPrices()
{
return(bookprices);
}
void Store::PrintAll()
{
return();
}
************ 3. Main File************* NEED help finishing
#include"Store.h"
#include<iostream>
#include<fstream>
usingnamespacestd;
intMenu();
intmain()
{
{
BookBook;
ifstreamin;
in.open("/Users/ptrinh/Desktop/Books.dat");
if(!in)
{
cout<<"error opening file";
return1;
}
}
}
Explanation / Answer
Sorry your returns are all wrong. numOfCopies is supposed to return an int, and you have it not returning anything at all. You have FindTitleReorder as having no return value (return type void), yet you have it returning an int. Your class definition has several errors, by the way. You don't need the ints reorder and delete, and you need a pointer to the class, so you can use it in a linked list. Also, shouldn't the class be called Book, instead of store? Your assignment was to create a solution that uses a linked list of book data. Your function FindTitleReorder should take a pointer to the head of the linked list, walk down that list looking at the copies fields, and return a list of all the objects with less than 10 copies. I would suggest having the function return a linked list of all the book titles that meet the criteria. You should start from scratch, because what you have so far is more wrong than right.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.