Hi everybody, this is my first post to the community and I need your help. I have a final project that I am working on for my C++ programming class. The functional particulars are:

  • Program must be command-line based and interactive, allowing the user to control its operation by entering commands. For example, a user may type “add” and the program will respond by asking for data to add. Typing “exit” may end the program.
  • Program must manage some type of record- or object-based data. In other words, it must manage multiple instances of the same type of data. So essentially, a collection of objects, each of which contains a collection of objects.
  • Ability to accept new data entered by the user.
  • Ability to search for specific, previously entered data.
  • Ability to save all data to a file.
  • Ability to retrieve previously stored data from the file.
  • Ability to display a list of all data items and their sub-items.
  • Maintainability Requirements:
    • Program must have intelligible comments that adequately describe key parts of the code.
    • All variables and class names should clearly describe their purpose and use consistent casing. Spelling doesn't’t count, but try your best.

    Coding Requirements:

    • Program must comprise at least five classes.
    • Program must use inheritance and demonstrate polymorphism.
    • Program must use at least one loop.
    • Program must read and write a file.

    This assignment is due in Week 9, and worth 30% of your overall grade.

    Deliverables

    1. Working object-oriented program meeting the above requirements. You must submit all the source code as well as a compiled executable.
    2. Simple user’s Guide that explains how your program works.

I am looking at the database having these categories: movie name, rating, year, actor(s) name(s), and upcoming releases. I need your help in getting me started and walking me through the fundamentals of writing the program. Your help is greatly appreciated and it will help me learn more about programming.
:confused:

That is the exact same final I have in my C++ programming class at Westwood Online

I am with Westwood Online as well but I chose to do this program because I could not think of anything else.

Okay, I am posting what I have so far. Here goes.

#include <iostream>
#include <string>
#include "dvdType.h"
using namespace std;
ostream& operator<< (ostream& osObject, const dvdType& name)
{
osObject << name.dvdNameList << year.dvdYearList;
return osObject;
}
istream& operator>> (istream& isObject, dvdType& name)
{
isObject >> name.dvdNameList >> year.dvdYearList;
return isObject;
}
void dvdType::print() const
{
cout << dvdName << " " << dvdYear << endl;
}
void dvdType::setName(string name)
{
dvdName = name;
dvdYear = year;
}
string dvdType::getdvdNameList() const
{
return dvdName;
}
string dvdType::getdvdYearList() const
{
return year;
}
//constructor
dvdType::dvdType(string name, string year)
{
dvdName = name;
dvdYear = year;
}

//Program: Sales data analysis
#include <iostream>
#include <fstream>
#include <iomanip>
#include <string>
using namespace std;
struct dvdLibrary
{
string dvdNameList; //name of dvd
string starNameList; //name of star of dvd
int dvdYearList; //year dvd released
string upcomingReleases; //projected releases to add to dvd collection
};

int main()
{
//Step 1
ifstream infile; //input file stream variable
ofstream outfile; //output file stream variable
string inputFile; //variable to hold the input file name
string outputFile; //variable to hold the output file name

cout << "Enter the Dvd name: "; //Step 2
cin >> inputFile; //Step 3
cout << endl;
infile.open(inputFile.c_str()); //Step 4
if (!infile) //Step 5
{
cout << "Cannot open the input file."
<< endl;
return 1;
}
initialize(infile, dvdNameList); //Step 6
infile.close(); //Step 7
infile.clear(); //Step 7
cout << "Enter the stars name: "; //Step 8
cin >> inputFile; //Step 9
cout << endl;
infile.open(inputFile.c_str()); //Step 10
if (!infile) //Step 11
{
cout << "Cannot open the input file."
<< endl;
return 1;
}
outfile.open(outputFile.c_str()); //Step 14
outfile << fixed << showpoint
<< setprecision(2); //Step 15
dvdNameList(infile, dvdNameList); //Step 16
starName(starNameList); //Step 17
dvdYear(dvdYearList);
starName(outfile, starNameList); //Step 20
dvdYear(outfile, dvdYearList); //Step 21

infile.close(); //Step 22
outfile.close(); //Step 22
return 0;
}

#ifndef H_dvdType
#define H_dvdType
#include <string>

using namespace std;
class dvdType
{
friend ostream& operator<< (ostream&, const dvdType &);
friend istream& operator>> (istream&, dvdType &);
public:
void print() const;
//Function to output the first name and last name
//in the form firstName lastName.

void setName(string);
//Function to set dvdName according
//to the parameters.
//Postcondition: dvdName = name.
string getDvdNameList() const;
//Function to return the name list.
//Postcondition: The value of the nameList is returned.
string getDvdYearList() const;
//Function to return the year of the dvd.
//Postcondition: The value of the dvdYear is returned.
dvdType(string name = "", string year = "");
//constructor
//Sets Name and year according to the parameters.
//The default values of the parameters are empty strings.
//Postcondition: nameList = name; yearList = year
private:
string nameList; //variable to store the first name
string yearList; //variable to store the last name
};
#endif

i don't know how the smiley face got in there, please ignore it, it's not part of the code of course.

i don't know how the smiley face got in there, please ignore it, it's not part of the code of course.

The smily wouldn't have appeared if you had used code tags.

So what happens when you try to run it? Or compile it? Otherwise we just end up guessing.

A tip for writing your program: It looks like you're trying to write too many things at once. For example, I prefer to implement file I/O near the end of development of a program, and instead use constants. Why? Because I know constants work. It's one less thing to worry about when coding the body of the class.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.