📄 videotypeimp.cpp
字号:
#include <iostream>
#include <string>
#include "videoType.h"
using namespace std;
void videoType::setVideoInfo(string title, string star1,
string star2, string producer,
string director,
string productionCo,
int setInStock)
{
videoTitle = title;
movieStar1 = star1;
movieStar2 = star2;
movieProducer = producer;
movieDirector = director;
movieProductionCo = productionCo;
copiesInStock = setInStock;
}
void videoType::checkOut()
{
if (getNoOfCopiesInStock() > 0)
copiesInStock--;
else
cout << "Currently out of stock" << endl;
}
void videoType::checkIn()
{
copiesInStock++;
}
int videoType::getNoOfCopiesInStock() const
{
return copiesInStock;
}
void videoType::printTitle() const
{
cout << "Video Title: " << videoTitle << endl;
}
void videoType::printInfo() const
{
cout << "Video Title: " << videoTitle << endl;
cout << "Stars: " << movieStar1 << " and "
<< movieStar2 << endl;
cout << "Producer: " << movieProducer << endl;
cout << "Director: " << movieDirector << endl;
cout << "Production Company: " << movieProductionCo
<< endl;
cout << "Copies in stock: " << copiesInStock
<< endl;
}
bool videoType::checkTitle(string title)
{
return(videoTitle == title);
}
void videoType::updateInStock(int num)
{
copiesInStock += num;
}
void videoType::setCopiesInStock(int num)
{
copiesInStock = num;
}
string videoType::getTitle() const
{
return videoTitle;
}
videoType::videoType(string title, string star1,
string star2, string producer,
string director,
string productionCo, int setInStock)
{
setVideoInfo(title, star1, star2, producer, director,
productionCo, setInStock);
}
bool videoType::operator==(const videoType& other) const
{
return (videoTitle == other.videoTitle);
}
bool videoType::operator!=(const videoType& other) const
{
return (videoTitle != other.videoTitle);
}
ostream& operator<< (ostream& osObject, const videoType& video)
{
osObject << endl;
osObject << "Video Title: " << video.videoTitle << endl;
osObject << "Stars: " << video.movieStar1 << " and "
<< video.movieStar2 << endl;
osObject << "Producer: " << video.movieProducer << endl;
osObject << "Director: " << video.movieDirector << endl;
osObject << "Production Company: "
<< video.movieProductionCo << endl;
osObject << "Copies in stock: " << video.copiesInStock
<< endl;
osObject << "_____________________________________"
<< endl;
return osObject;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -