Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
60 changes: 60 additions & 0 deletions Task2_utkarsh_k/Task2/utkarsh_k/Admin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
#ifndef ADMIN_H
#define ADMIN_H

#include <string>
#include <iostream>
#include <vector>
#include "Movie.h"
#include "TVShow.h"

using namespace std;

class Admin {
string username;
string password;

public:
Admin(string uname, string pwd) : username(uname), password(pwd) {}

bool login(string uname, string pwd) {
return (uname == username && pwd == password);
}

void addMovie(vector<Movie>& movies, Movie m) {
movies.push_back(m);
cout << "Movie added successfully.\n";
}

void addTVShow(vector<TVShow>& shows, TVShow s) {
shows.push_back(s);
cout << "TV Show added successfully.\n";
}

void removeMovie(vector<Movie>& movies, string title) {
for (auto it = movies.begin(); it != movies.end(); ++it) {
if (it->getTitle() == title) {
movies.erase(it);
cout << "Movie removed successfully.\n";
return;
}
}
cout << "Movie not found.\n";
}

void removeTVShow(vector<TVShow>& shows, string title) {
for (auto it = shows.begin(); it != shows.end(); ++it) {
if (it->getTitle() == title) {
shows.erase(it);
cout << "TV Show removed successfully.\n";
return;
}
}
cout << "TV Show not found.\n";
}

void checkUserDues(const User& u) {
cout << u.getUsername() << " owes ₹" << u.getChargesDue() << endl;
}
};

#endif
32 changes: 32 additions & 0 deletions Task2_utkarsh_k/Task2/utkarsh_k/Content.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#ifndef CONTENT_H
#define CONTENT_H

#include <string>
using namespace std;

class Content {
protected:
string title;
string genre;
float rating;
bool is_rented;
bool is_purchased;

public:
Content(string title, string genre, float rating)
: title(title), genre(genre), rating(rating), is_rented(false), is_purchased(false) {}

virtual void display() = 0; // Pure virtual function

string getTitle() const { return title; }
string getGenre() const { return genre; }
float getRating() const { return rating; }

bool getIsRented() const { return is_rented; }
bool getIsPurchased() const { return is_purchased; }

void setRented(bool rented) { is_rented = rented; }
void setPurchased(bool purchased) { is_purchased = purchased; }
};

#endif
14 changes: 14 additions & 0 deletions Task2_utkarsh_k/Task2/utkarsh_k/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Use official GCC compiler image
FROM gcc:latest

# Set working directory
WORKDIR /app

# Copy all source code into the container
COPY . .

# Compile all .cpp files into a single executable named netflix
RUN g++ main.cpp Movie.cpp TVShow.cpp Admin.cpp User.cpp -o netflix

# Command to run the app
CMD ["./netflix"]
Empty file.
25 changes: 25 additions & 0 deletions Task2_utkarsh_k/Task2/utkarsh_k/Movie.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#ifndef MOVIE_H
#define MOVIE_H

#include "Content.h"
#include <iostream>

class Movie : public Content {
int duration;
float rent_cost;
float purchase_cost;

public:
Movie(string title, string genre, float rating, int duration, float rent_cost, float purchase_cost)
: Content(title, genre, rating), duration(duration), rent_cost(rent_cost), purchase_cost(purchase_cost) {}

void display() override {
cout << "Movie: " << title << " | Genre: " << genre << " | Rating: " << rating
<< " | Duration: " << duration << " min | Rent: ₹" << rent_cost << " | Buy: ₹" << purchase_cost << endl;
}

float getRentCost() const { return rent_cost; }
float getPurchaseCost() const { return purchase_cost; }
};

#endif
Empty file.
28 changes: 28 additions & 0 deletions Task2_utkarsh_k/Task2/utkarsh_k/TVShow.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#ifndef TVSHOW_H
#define TVSHOW_H

#include "Content.h"
#include <iostream>

class TVShow : public Content {
int seasons;
int episodes_per_season;
float rent_per_season;
float purchase_per_season;

public:
TVShow(string title, string genre, float rating, int seasons, int eps, float rent, float purchase)
: Content(title, genre, rating), seasons(seasons), episodes_per_season(eps),
rent_per_season(rent), purchase_per_season(purchase) {}

void display() override {
cout << "TV Show: " << title << " | Genre: " << genre << " | Rating: " << rating
<< " | Seasons: " << seasons << " | Episodes/Season: " << episodes_per_season
<< " | Rent/Season: ₹" << rent_per_season << " | Buy/Season: ₹" << purchase_per_season << endl;
}

float getRentPerSeason() const { return rent_per_season; }
float getPurchasePerSeason() const { return purchase_per_season; }
};

#endif
Empty file.
Empty file.
Loading