Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Software Engineering Expert

Assignment #2 - Classes and File I/O in C++

Grading: For each programming assignment, you are graded by explaining and demoing your code to a TA.

You must demo your program BEFORE the next assignment is due, and if you fail to do so, you will automatically lose.

Your job is to convince the TA that your program works correctly, i.e. show your TA how to use/break your program?

Problem Statement:

We will simulate the physical (not online) Netflix rental system.

You will write a program that creates a class to hold Netflix data, which will have Movie objects.

You will ask the user if he/she wants to enter a new movie to the database or find a movie to rent.

• If the user wants to enter a movie, then you will prompt the user for how many movies they want to enter into the database  and the movie information for each: title, stars, number of cast members, cast member names, movie rating, and copies.

• If the user wants to search for a movie, then you will prompt the user for the information they want to use for the search: name, number of stars, specific cast member, or rating.

In addition, you will continually ask the user if they want to enter a new movie to the database or search for movies based on some criteria.

Here are the class member variables for our Netflix system and movie objects.

It is your job to determine the behavior for each class.

class netflix {
public:
...
private:
movie *m; //This is a dynamic array of movies
int num_movies;
};

class movie {
public:
...
private:
string name;
int stars;
int num_cast;
string *cast; //This is a dynamic array of strings
string rating;
int copies;
};

Example Run of Adding Movies:

Do you want to enter a movie to the database or find a movie to rent? (1 - enter, 2 - find, or 0 - exit) 1

How many movies do you want to enter to the database? 1

Enter the name of your movie: Computer Science 162

How many stars? 5

How many cast members? 2

Enter cast member 1: Jennifer Parham-Mocello

Enter cast member 2: Students

Enter the movie rating: PG

How many copies of this movie: 2

Added to the database!

Do you want to enter a movie to the database or find a movie to rent? (1 - enter, 2 - find, or 0 - exit) 0

Example Run of Renting Movies:

Do you want to enter a movie to the database or find a movie to rent? (1 - enter, 2 - find, or 0 - exit) 2

Do you want to find movies based on: 1 - name, 2 - number of stars, 3 - specific cast member, or 4 - rating)? 1

What is the title? Computer Science 162

Found 1 movie:
Number 1

Title: Computer Science 162

Stars: 5

Cast Members: Jennifer Parham-Mocello, Students

Rating: PG

Current Copies to Rent: 1

Which movie do you want to rent? 1

Movie, Computer Science 162, rented!

Do you want to enter a movie to the database or find a movie to

rent? (1 - enter, 2 - find, or 0 - exit) 0

Your file, netflix.dat, should have the following information separated by the pipe

delimiter. For example, here are the categories in the file:

#|Title|Stars|Cast|Members|Rating|Copies|Rented

Example for the above database:

1|Computer Science 162|5|2|Jennifer Parham-Mocello|Students|PG|2|1

Things to consider in this assignment:

Remember, you need to update the number of movies rented, when the user decides to

rent a specific movie. The current number of copies you have to rent is:

copies to rent = total copies - rented

You need to look search through the database to see how many movies match the

search criteria, in order to know how many movie objects to create to hold the found
movies.

You are not allow to read the whole Netflix database into the program to
search!!!

Requirements:

• You are required to have constructors, destructors, copy constructors, and the appropriate use of const for every class.

• You must have accessor and mutator functions for each member in the class.

• Appropriate behavior for each object to correctly add and rent movies from the data file.

• You must have a Makefile, .h and .cpp for each class, and a driver file with the main function.

• Your program must not have a memory leak!!!

• Make sure you try to keep your functions at a 15 lines max.

Extra Credit:

You must have proper error checking and handling for the input, e.g. choice that isn't valid, try to check out a movie with zero copies, etc. Program Style/Comments

In your implementation, make sure that you include a program header in your program, in addition to proper indentation/spacing and other comments! Below is an example header to include. Make sure you review the style guidelines for

this class, and begin trying to follow them, i.e. don't align everything on the left or put everything on one line!
http://classes.engr.oregonstate.edu/eecs/spring2015/cs162-001/162_style_guideline.pdf

/******************************************************
** Program: rental.cpp
** Author: Your Name
** Date: 04/26/2015
** Description:
** Input:
** Output:

******************************************************/
 Design for Assignment #2 changes/Testing
•  How did your design for searching for data in Assignment #2 change during implementation?

•  What were the actual values from your testing? Did these match your expected values? What did you do to make sure you get the expected values?

Please see the template for this document: Polya_template.pdf You need to have a table with these headings: Input Values

Expected Output Did Actual Meet Expected?

3 Error message for

choice 3 because that

isn't an option.

Reprompt for choice again.

Yes

Electronically submit your C++ program (.h, .cpp, and Makefile files, not your

executable!!!) and design/testing document, as a pdf, by the assignment due date, using

TEACH.

**NOTE: The easiest way to upload your program from ENGR to TEACH is to map a

network drive to your home directory on ENGR. Mac or Windows, See:

http://engineering.oregonstate.edu/computing/fileaccess/

Software Engineering, Computer Science

  • Category:- Software Engineering
  • Reference No.:- M91595489
  • Price:- $40

Priced at Now at $40, Verified Solution

Have any Question?


Related Questions in Software Engineering

Overviewyou are required to modify and logically extend

Overview You are required to modify and logically extend the functionality of a provided code base to implement a game. This requires you to modify the code base as well as create documentation and implement various user ...

Address the following integrating biblical perspectives

Address the following, integrating biblical perspectives where appropriate: Define a hate crime and describe how white supremacist groups use the Internet to spread their message of hate. Explain why hate crime legislati ...

In this assignment you will answer the following review

In this assignment, you will answer the following review questions from the reading materials of the module/week. 1. "What are the key components of a typical P2P application? Describe their functions." 2. "What are the ...

Write review on this article with apa formatalthough

Write review on this article with APA format. Although computer crimes are being seen in our society more and more each day, it is still difficult to prosecute people who commit these crimes mainly because everything is ...

Research projectin the course we have covered various

RESEARCH PROJECT In the course, we have covered various security and privacy issues that arise in the cyberspace field. We have learned to identify these risks and have discussed the current approaches and developments f ...

Write reply to this article with references with apa

Write reply to this article with references with APA bibliography. Hate Crimes Over the past couple of years, hate crimes have been on the rise in America's largest cities. Studies show that there were sharp spikes in th ...

Assignment part 1objectives to learn to identify the

Assignment Part 1 Objectives: To learn to identify the relevant use cases for a given application, describe the use cases and develop an object-oriented domain model. Problem Statement - Standing Orders Management System ...

In this assignment you will answer the following questions

In this assignment, you will answer the following questions related to Android platform and Android security design. 1. Describe Android architecture in detail by explaining the four conceptual layers. 2. Describe Androi ...

Assignment lab - statement of workclient liberty vacation

Assignment Lab - Statement of Work Client: Liberty Vacation Planning Inc. (LVP) Project: Website Assessment 1. Project Objectives With this statement of work, LVP is engaging you to conduct a website assessment to determ ...

Reply to this article with apa referencehate crimes

Reply to this article with APA reference. Hate crimes According to Merriam-Webster, hate crime is any of various crimes (such as assault or defacement of property) when motivated by hostility to the victim as a member of ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As