User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 391,655 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,790 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 949 | Replies: 5
Reply
Join Date: Dec 2006
Location: Delaware
Posts: 4
Reputation: rhythm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rhythm rhythm is offline Offline
Newbie Poster

Solution Movie database Help

  #1  
Feb 18th, 2007
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.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2006
Posts: 70
Reputation: SHWOO is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
SHWOO SHWOO is offline Offline
Junior Poster in Training

Re: Movie database Help

  #2  
Feb 18th, 2007
That is the exact same final I have in my C++ programming class at Westwood Online
Climbing the learning curve of C++
Becoming an expert seems light years away!
Reply With Quote  
Join Date: Dec 2006
Location: Delaware
Posts: 4
Reputation: rhythm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rhythm rhythm is offline Offline
Newbie Poster

Re: Movie database Help

  #3  
Feb 18th, 2007
I am with Westwood Online as well but I chose to do this program because I could not think of anything else.
Reply With Quote  
Join Date: Dec 2006
Location: Delaware
Posts: 4
Reputation: rhythm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rhythm rhythm is offline Offline
Newbie Poster

Re: Movie database Help

  #4  
Feb 18th, 2007
Okay, I am posting what I have so far. Here goes.

#include<iostream>
#include<string>
#include"dvdType.h"
usingnamespace 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>
usingnamespace 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>

usingnamespace 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
Reply With Quote  
Join Date: Dec 2006
Location: Delaware
Posts: 4
Reputation: rhythm is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
rhythm rhythm is offline Offline
Newbie Poster

Re: Movie database Help

  #5  
Feb 18th, 2007
i don't know how the smiley face got in there, please ignore it, it's not part of the code of course.
Reply With Quote  
Join Date: Apr 2006
Location: Canada
Posts: 4,445
Reputation: John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light John A is a glorious beacon of light 
Rep Power: 15
Solved Threads: 265
Moderator
Staff Writer
Featured Blogger
John A's Avatar
John A John A is offline Offline
Vampirical Moderator

Re: Movie database Help

  #6  
Feb 18th, 2007
Originally Posted by rhythm View Post
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.
tuxation.com - Linux articles, tutorials, and discussions
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb C++ Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the C++ Forum

All times are GMT -4. The time now is 1:34 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC