SlideShare a Scribd company logo
Can you convert this code into a C++ code?
////////////////////////////////////////////
DVD.java
package movie;
public class DVD {
private String movieTitle;
private String movieStars[];
private String movieDirector;
private String movieProducer;
private String movieProductionCo;
private int numberOfCopies;
DVD(String title, String[] stars, String director, String producer, String production, int
copies)
{
movieTitle = title;
movieStars = stars;
movieDirector = director;
movieProducer = producer;
movieProductionCo = production;
numberOfCopies = copies;
}
public String getMovieTitle() {
return movieTitle;
}
public void setMovieTitle(String movieTitle) {
this.movieTitle = movieTitle;
}
public String[] getMovieStars() {
return movieStars;
}
public void setMovieStars(String[] movieStars) {
this.movieStars = movieStars;
}
public String getMovieDirector() {
return movieDirector;
}
public void setMovieDirector(String movieDirector) {
this.movieDirector = movieDirector;
}
public String getMovieProducer() {
return movieProducer;
}
public void setMovieProducer(String movieProducer) {
this.movieProducer = movieProducer;
}
public String getMovieProductionCo() {
return movieProductionCo;
}
public void setMovieProductionCo(String movieProductionCo) {
this.movieProductionCo = movieProductionCo;
}
public int getNumberOfCopies() {
return numberOfCopies;
}
public void setNumberOfCopies(int numberOfCopies) {
this.numberOfCopies = numberOfCopies;
}
public void incrementCopies()
{
numberOfCopies++;
}
public boolean checkOut()
{
if(numberOfCopies>0)
{
numberOfCopies--;
return true;
}
else return false;
}
public void checkIn()
{
numberOfCopies++;
}
@Override
public String toString() {
return "Movie: " + movieTitle + ", Stars: " + movieStars[0] + " and " + movieStars[1] +
", Director: " + movieDirector +
",  Producer: " + movieProducer + ", Production Company: "+movieProductionCo;
}
}
PersonType.java
package movie;
public class PersonType {
private String firstName;
private String lastName;
PersonType(String firstName, String lastName)
{
this.firstName = firstName;
this.lastName = lastName;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
}
Customer.java
package movie;
import java.util.ArrayList;
import java.util.List;
public class Customer extends PersonType{
List rentedDVDs;
List rentalCount;
int accountNumber;
private static int counter = 1001;
Customer(String firstName, String lastName) {
super(firstName, lastName);
rentedDVDs = new ArrayList();
rentalCount = new ArrayList();
accountNumber = counter++;
}
public int getAccountNumber()
{
return accountNumber;
}
public String getName()
{
return getFirstName() + " " + getLastName();
}
public void setName(String firstName, String lastName)
{
setFirstName(firstName);
setLastName(lastName);
}
public void rentDVD(DVD dvd)
{
for(int i=0; i1)
rentalCount.set(i, rentalCount.get(i)-1);
else if(rentalCount.get(i)==1)
{
rentalCount.remove(i);
rentedDVDs.remove(i);
}
return;
}
}
System.out.println("The DVD was not rented to the customer !");
}
public int rentalCount()
{
int total = 0;
for(int i: rentalCount)
total += i;
return total;
}
@Override
public String toString() {
return "Customer Name : " + getName() + "Account Number: " + accountNumber +
"Total rental Count: " + rentalCount();
}
}
DVDStore.java
package movie;
import java.util.ArrayList;
import java.util.List;
public class DVDStore {
List listOfDVDs;
List customers;
DVDStore()
{
listOfDVDs = new ArrayList();
customers = new ArrayList();
}
public void addDVD(DVD newdvd)
{
DVD dvd = searchDVD(newdvd.getMovieTitle());
if(dvd == null)
{
listOfDVDs.add(newdvd);
}
else
listOfDVDs.get(listOfDVDs.indexOf(newdvd)).incrementCopies();
}
public void addCustomer(Customer customer)
{
customers.add(customer);
}
public DVD searchDVD(String title)
{
DVD dvd = null;
for(DVD currentDVD: listOfDVDs)
{
if(currentDVD.getMovieTitle().equals(title))
{
dvd = currentDVD;
}
}
return dvd;
}
private int findCustomer(int accountNumber)
{
for(int i=0; i0)
System.out.println(title + " is in stock");
}
menu(store);
break;
case 5:store.printMovieTitles();
menu(store);
break;
case 6: store.printAllDVDs();
menu(store);
break;
case 9: return;
}
}
public static void main(String[] args) {
DVDStore store = new DVDStore();
try {
Scanner filereader = new Scanner(new File("movies.txt"));
while(filereader.hasNextLine())
{
String title = filereader.nextLine().replace("DVD ", "");
String star1 = filereader.nextLine().replace("movie ", "");
String star2 = filereader.nextLine().replace("movie ", "");
String producer = filereader.nextLine().replace("movie ", "");
String director = filereader.nextLine().replace("movie ", "");
String production = filereader.nextLine().replace("movie ", "");
String copies = filereader.nextLine();
store.addDVD(new DVD(title, new String[]{star1, star2}, director, producer,
production, Integer.valueOf(copies)));
}
} catch (FileNotFoundException e) {
System.out.println("File format is wrong !");
e.printStackTrace();
}
System.out.println("Enter a customer first name: ");
Scanner consoleReader = new Scanner(System.in);
String fName = consoleReader.next();
System.out.println("Enter a customer last name: ");
String lname = consoleReader.next();
Customer customer = new Customer(fName, lname);
store.addCustomer(customer);
menu(store);
}
}
Solution
main.cpp
#include
#include
#include
#include "dvdType.h"
#include "dvdListType.h"
using namespace std;
void createDVDList(ifstream& infile,
dvdListType& dvdList);
void displayMenu();
int main()
{
dvdListType dvdList;
int choice;
char ch;
string title;
ifstream infile;
//open the input file
infile.open("dvdDat.txt");
if (!infile)
{
cout << "The input file does not exist. "
<< "The program terminates!!!" << endl;
return 1;
}
//create the DVD list
createDVDList(infile, dvdList);
infile.close();
//show the menu
displayMenu();
cout << "Enter your choice: ";
cin >> choice; //get the request
cin.get(ch);
cout << endl;
//process the requests
while (choice != 9)
{
switch (choice)
{
case 1:
cout << "Enter the title: ";
getline(cin, title);
cout << endl;
if (dvdList.dvdSearch(title))
cout << "The store carries " << title
<< endl;
else
cout << "The store does not carry "
<< title << endl;
break;
case 2:
cout << "Enter the title: ";
getline(cin, title);
cout << endl;
if (dvdList.dvdSearch(title))
{
if (dvdList.isDVDAvailable(title))
{
dvdList.dvdCheckOut(title);
cout << "Enjoy your movie: "
<< title << endl;
}
else
cout << "Currently " << title
<< " is out of stock." << endl;
}
else
cout << "The store does not carry "
<< title << endl;
break;
case 3:
cout << "Enter the title: ";
getline(cin, title);
cout << endl;
if (dvdList.dvdSearch(title))
{
dvdList.dvdCheckIn(title);
cout << "Thanks for returning "
<< title << endl;
}
else
cout << "The store does not carry "
<< title << endl;
break;
case 4:
cout << "Enter the title: ";
getline(cin, title);
cout << endl;
if (dvdList.dvdSearch(title))
{
if (dvdList.isDVDAvailable(title))
cout << title << " is currently in "
<< "stock." << endl;
else
cout << title << " is currently out "
<< "of stock." << endl;
}
else
cout << "The store does not carry "
<< title << endl;
break;
case 5:
dvdList.dvdPrintTitle();
break;
case 6:
dvdList.print();
break;
default:
cout << "Invalid selection." << endl;
}//end switch
displayMenu(); //display menu
cout << "Enter your choice: ";
cin >> choice; //get the next request
cin.get(ch);
cout << endl;
}//end while
return 0;
}
void createDVDList(ifstream& infile,
dvdListType& dvdList)
{
string title;
string star1;
string star2;
string producer;
string director;
string productionCo;
char ch;
int inStock;
dvdType newDVD;
getline(infile, title);
while (infile)
{
getline(infile, star1);
getline(infile, star2);
getline(infile, producer);
getline(infile, director);
getline(infile, productionCo);
infile >> inStock;
infile.get(ch);
newDVD.setDVDInfo(title, star1, star2, producer,
director, productionCo, inStock);
dvdList.insertFirst(newDVD);
getline(infile, title);
}//end while
}//end createDVDList
void displayMenu()
{
cout << "Select one of the following:" << endl;
cout << "1: To check whether the store carries a "
<< "particular DVD." << endl;
cout << "2: To check out a DVD." << endl;
cout << "3: To check in a DVD." << endl;
cout << "4: To check whether a particular DVD is "
<< "in stock." << endl;
cout << "5: To print only the titles of all the DVDs."
<< endl;
cout << "6: To print a list of all the DVDs." << endl;
cout << "9: To exit" << endl;
} //end displayMenu
dvdListType.h
#ifndef H_DVDLinkedListType
#define H_DVDLinkedListType
#include
#include "unorderedLinkedList.h"
#include "dvdType.h"
using namespace std;
class dvdListType:public unorderedLinkedList
{
public:
bool dvdSearch(string title) const;
bool isDVDAvailable(string title) const;
void dvdCheckOut(string title);
void dvdCheckIn(string title);
bool dvdCheckTitle(string title) const;
void dvdUpdateInStock(string title, int num);
void dvdSetCopiesInStock(string title, int num);
void dvdPrintTitle() const;
private:
void searchDVDList(string title, bool& found,
nodeType* &current) const;
};
#endif
dvdListTypeImp.cpp
#include
#include
#include "dvdListType.h"
using namespace std;
void dvdListType::searchDVDList(string title, bool& found,
nodeType* &current) const
{
found = false; //set found to false
current = first; //set current to point to the first node
//in the list
while (current != nullptr && !found) //search the list
if (current->info.checkTitle(title)) //the item is found
found = true;
else
current = current->link; //advance current to
//the next node
}//end searchDVDList
bool dvdListType::isDVDAvailable(string title) const
{
bool found;
nodeType *location;
searchDVDList(title, found, location);
if (found)
found = (location->info.getNoOfCopiesInStock() > 0);
else
found = false;
return found;
}
void dvdListType::dvdCheckIn(string title)
{
bool found = false;
nodeType *location;
searchDVDList(title, found, location); //search the list
if (found)
location->info.checkIn();
else
cout << "The store does not carry " << title
<< endl;
}
void dvdListType::dvdCheckOut(string title)
{
bool found = false;
nodeType *location;
searchDVDList(title, found, location); //search the list
if (found)
location->info.checkOut();
else
cout << "The store does not carry " << title
<< endl;
}
bool dvdListType::dvdCheckTitle(string title) const
{
bool found = false;
nodeType *location;
searchDVDList(title, found, location); //search the list
return found;
}
void dvdListType::dvdUpdateInStock(string title, int num)
{
bool found = false;
nodeType *location;
searchDVDList(title, found, location); //search the list
if (found)
location->info.updateInStock(num);
else
cout << "The store does not carry " << title
<< endl;
}
void dvdListType::dvdSetCopiesInStock(string title, int num)
{
bool found = false;
nodeType *location;
searchDVDList(title, found, location);
if (found)
location->info.setCopiesInStock(num);
else
cout << "The store does not carry " << title
<< endl;
}
bool dvdListType::dvdSearch(string title) const
{
bool found = false;
nodeType *location;
searchDVDList(title, found, location);
return found;
}
void dvdListType::dvdPrintTitle() const
{
nodeType* current;
current = first;
while (current != nullptr)
{
current->info.printTitle();
current = current->link;
}
}
dvdType.h
#ifndef H_dvdType
#define H_dvdType
#include
#include
using namespace std;
class dvdType
{
friend ostream& operator<< (ostream&, const dvdType&);
public:
void setDVDInfo(string title, string star1,
string star2, string producer,
string director, string productionCo,
int setInStock);
int getNoOfCopiesInStock() const;
void checkOut();
void checkIn();
void printTitle() const;
void printInfo() const;
bool checkTitle(string title);
void updateInStock(int num);
void setCopiesInStock(int num);
string getTitle() const;
dvdType(string title = "", string star1 = "",
string star2 = "", string producer = "",
string director = "", string productionCo = "",
int setInStock = 0);
//Overload the relational operators.
bool operator==(const dvdType&) const;
bool operator!=(const dvdType&) const;
private:
string dvdTitle; //variable to store the name
//of the movie
string movieStar1; //variable to store the name
//of the star
string movieStar2; //variable to store the name
//of the star
string movieProducer; //variable to store the name
//of the producer
string movieDirector; //variable to store the name
//of the director
string movieProductionCo; //variable to store the name
//of the production company
int copiesInStock; //variable to store the number of
//copies in stock
};
#endif
dvdTypeImp.cpp
#include
#include
#include "dvdType.h"
using namespace std;
void dvdType::setDVDInfo(string title, string star1,
string star2, string producer,
string director,
string productionCo,
int setInStock)
{
dvdTitle = title;
movieStar1 = star1;
movieStar2 = star2;
movieProducer = producer;
movieDirector = director;
movieProductionCo = productionCo;
copiesInStock = setInStock;
}
void dvdType::checkOut()
{
if (getNoOfCopiesInStock() > 0)
copiesInStock--;
else
cout << "Currently out of stock" << endl;
}
void dvdType::checkIn()
{
copiesInStock++;
}
int dvdType::getNoOfCopiesInStock() const
{
return copiesInStock;
}
void dvdType::printTitle() const
{
cout << "DVD Title: " << dvdTitle << endl;
}
void dvdType::printInfo() const
{
cout << "DVD Title: " << dvdTitle << 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 dvdType::checkTitle(string title)
{
return(dvdTitle == title);
}
void dvdType::updateInStock(int num)
{
copiesInStock += num;
}
void dvdType::setCopiesInStock(int num)
{
copiesInStock = num;
}
string dvdType::getTitle() const
{
return dvdTitle;
}
dvdType::dvdType(string title, string star1,
string star2, string producer,
string director,
string productionCo, int setInStock)
{
setDVDInfo(title, star1, star2, producer, director,
productionCo, setInStock);
}
bool dvdType::operator==(const dvdType& other) const
{
return (dvdTitle == other.dvdTitle);
}
bool dvdType::operator!=(const dvdType& other) const
{
return (dvdTitle != other.dvdTitle);
}
ostream& operator<< (ostream& osObject, const dvdType& dvd)
{
osObject << endl;
osObject << "DVD Title: " << dvd.dvdTitle << endl;
osObject << "Stars: " << dvd.movieStar1 << " and "
<< dvd.movieStar2 << endl;
osObject << "Producer: " << dvd.movieProducer << endl;
osObject << "Director: " << dvd.movieDirector << endl;
osObject << "Production Company: "
<< dvd.movieProductionCo << endl;
osObject << "Copies in stock: " << dvd.copiesInStock
<< endl;
osObject << "_____________________________________"
<< endl;
return osObject;
}
linkedList.h
#ifndef H_LinkedListType
#define H_LinkedListType
#include
#include
using namespace std;
//Definition of the node
template
struct nodeType
{
Type info;
nodeType *link;
};
template
class linkedListIterator
{
public:
linkedListIterator();
linkedListIterator(nodeType *ptr);
Type operator*();
linkedListIterator operator++();
bool operator==(const linkedListIterator& right) const;
bool operator!=(const linkedListIterator& right) const;
private:
nodeType *current; //pointer to point to the current
//node in the linked list
};
template
linkedListIterator::linkedListIterator()
{
current = nullptr;
}
template
linkedListIterator::
linkedListIterator(nodeType *ptr)
{
current = ptr;
}
template
Type linkedListIterator::operator*()
{
return current->info;
}
template
linkedListIterator linkedListIterator::operator++()
{
current = current->link;
return *this;
}
template
bool linkedListIterator::operator==
(const linkedListIterator& right) const
{
return (current == right.current);
}
template
bool linkedListIterator::operator!=
(const linkedListIterator& right) const
{ return (current != right.current);
}
template
class linkedListType
{
public:
const linkedListType& operator=
(const linkedListType&);
void initializeList();
bool isEmptyList() const;
void print() const;
int length() const;
void destroyList();
Type front() const;
Type back() const;
virtual bool search(const Type& searchItem) const = 0;
virtual void insertFirst(const Type& newItem) = 0;
virtual void insertLast(const Type& newItem) = 0;
virtual void deleteNode(const Type& deleteItem) = 0;
linkedListIterator begin();
linkedListIterator end();
linkedListType();
linkedListType(const linkedListType& otherList);
//copy constructor
~linkedListType();
protected:
int count; //variable to store the number of
//elements in the list
nodeType *first; //pointer to the first node of the list
nodeType *last; //pointer to the last node of the list
private:
void copyList(const linkedListType& otherList);
};
template
bool linkedListType::isEmptyList() const
{
return(first == nullptr);
}
template
linkedListType::linkedListType() //default constructor
{
first = nullptr;
last = nullptr;
count = 0;
}
template
void linkedListType::destroyList()
{
nodeType *temp; //pointer to deallocate the memory
//occupied by the node
while (first != nullptr) //while there are nodes in the list
{
temp = first; //set temp to the current node
first = first->link; //advance first to the next node
delete temp; //deallocate the memory occupied by temp
}
last = nullptr; //initialize last to nullptr; first has already
//been set to nullptr by the while loop
count = 0;
}
template
void linkedListType::initializeList()
{
destroyList(); //if the list has any nodes, delete them
}
template
void linkedListType::print() const
{
nodeType *current; //pointer to traverse the list
current = first; //set current so that it points to
//the first node
while (current != nullptr) //while more data to print
{
cout << current->info << " ";
current = current->link;
}
}//end print
template
int linkedListType::length() const
{
return count;
} //end length
template
Type linkedListType::front() const
{
assert(first != nullptr);
return first->info; //return the info of the first node
}//end front
template
Type linkedListType::back() const
{
assert(last != nullptr);
return last->info; //return the info of the last node
}//end back
template
linkedListIterator linkedListType::begin()
{
linkedListIterator temp(first);
return temp;
}
template
linkedListIterator linkedListType::end()
{
linkedListIterator temp(nullptr);
return temp;
}
template
void linkedListType::copyList
(const linkedListType& otherList)
{
nodeType *newNode; //pointer to create a node
nodeType *current; //pointer to traverse the list
if (first != nullptr) //if the list is nonempty, make it empty
destroyList();
if (otherList.first == nullptr) //otherList is empty
{
first = nullptr;
last = nullptr;
count = 0;
}
else
{
current = otherList.first; //current points to the
//list to be copied
count = otherList.count;
//copy the first node
first = new nodeType; //create the node
first->info = current->info; //copy the info
first->link = nullptr; //set the link field of
//the node to nullptr
last = first; //make last point to the
//first node
current = current->link; //make current point to
//the next node
//copy the remaining list
while (current != nullptr)
{
newNode = new nodeType; //create a node
newNode->info = current->info; //copy the info
newNode->link = nullptr; //set the link of
//newNode to nullptr
last->link = newNode; //attach newNode after last
last = newNode; //make last point to
//the actual last node
current = current->link; //make current point
//to the next node
}//end while
}//end else
}//end copyList
template
linkedListType::~linkedListType() //destructor
{
destroyList();
}//end destructor
template
linkedListType::linkedListType
(const linkedListType& otherList)
{
first = nullptr;
copyList(otherList);
}//end copy constructor
//overload the assignment operator
template
const linkedListType& linkedListType::operator=
(const linkedListType& otherList)
{
if (this != &otherList) //avoid self-copy
{
copyList(otherList);
}//end else
return *this;
}
#endif
unorderedLinkedList.h
#ifndef H_UnorderedLinkedList
#define H_UnorderedLinkedList
#include "linkedList.h"
using namespace std;
template
class unorderedLinkedList: public linkedListType
{
public:
bool search(const Type& searchItem) const;
//Function to determine whether searchItem is in the list.
//Postcondition: Returns true if searchItem is in the
// list, otherwise the value false is
// returned.
void insertFirst(const Type& newItem);
void insertLast(const Type& newItem);
void deleteNode(const Type& deleteItem);
};
template
bool unorderedLinkedList::
search(const Type& searchItem) const
{
nodeType *current; //pointer to traverse the list
bool found = false;
current = first; //set current to point to the first
//node in the list
while (current != nullptr && !found) //search the list
if (current->info == searchItem) //searchItem is found
found = true;
else
current = current->link; //make current point to
//the next node
return found;
}//end search
template
void unorderedLinkedList::insertFirst(const Type& newItem)
{
nodeType *newNode; //pointer to create the new node
newNode = new nodeType; //create the new node
newNode->info = newItem; //store the new item in the node
newNode->link = first; //insert newNode before first
first = newNode; //make first point to the
//actual first node
count++; //increment count
if (last == nullptr) //if the list was empty, newNode is also
//the last node in the list
last = newNode;
}//end insertFirst
template
void unorderedLinkedList::insertLast(const Type& newItem)
{
nodeType *newNode; //pointer to create the new node
newNode = new nodeType; //create the new node
newNode->info = newItem; //store the new item in the node
newNode->link = nullptr; //set the link field of newNode
//to nullptr
if (first == nullptr) //if the list is empty, newNode is
//both the first and last node
{
first = newNode;
last = newNode;
count++; //increment count
}
else //the list is not empty, insert newNode after last
{
last->link = newNode; //insert newNode after last
last = newNode; //make last point to the actual
//last node in the list
count++; //increment count
}
}//end insertLast
template
void unorderedLinkedList::deleteNode(const Type& deleteItem)
{
nodeType *current; //pointer to traverse the list
nodeType *trailCurrent; //pointer just before current
bool found;
if (first == nullptr) //Case 1; the list is empty.
cout << "Cannot delete from an empty list."
<< endl;
else
{
if (first->info == deleteItem) //Case 2
{
current = first;
first = first->link;
count--;
if (first == nullptr) //the list has only one node
last = nullptr;
delete current;
}
else //search the list for the node with the given info
{
found = false;
trailCurrent = first; //set trailCurrent to point
//to the first node
current = first->link; //set current to point to
//the second node
while (current != nullptr && !found)
{
if (current->info != deleteItem)
{
trailCurrent = current;
current = current-> link;
}
else
found = true;
}//end while
if (found) //Case 3; if found, delete the node
{
trailCurrent->link = current->link;
count--;
if (last == current) //node to be deleted
//was the last node
last = trailCurrent; //update the value
//of last
delete current; //delete the node from the list
}
else
cout << "The item to be deleted is not in "
<< "the list." << endl;
}//end else
}//end else
}//end deleteNode
#endif
dvdDat.txt
Titanic
Kate Winslet
Leonardo DiCaprio
Cameron
Cameron
20th Century Fox
2
One Fine Day
George Clooney
Michelle Pfeiffer
Obset
Hoffman
20th Century Fox
19
Sister Act
Whoopi GoldBerg
Maggie Smith
Schwartz
Ardolino
Touch Stone Pictures
14

More Related Content

Similar to Can you convert this code into a C++ code.pdf

J slider
J sliderJ slider
J slider
Sesum Dragomir
 
Inheritance compiler support
Inheritance compiler supportInheritance compiler support
Inheritance compiler support
Syed Zaid Irshad
 
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docxfilesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
ssuser454af01
 
Sbaw091006
Sbaw091006Sbaw091006
Sbaw091006
Atsushi Tadokoro
 
Symfony 4 Workshop - Limenius
Symfony 4 Workshop - LimeniusSymfony 4 Workshop - Limenius
Symfony 4 Workshop - Limenius
Ignacio Martín
 
Android workshop
Android workshopAndroid workshop
Android workshop
Michael Galpin
 
#include iostream #includeData.h #includePerson.h#in.pdf
#include iostream #includeData.h #includePerson.h#in.pdf#include iostream #includeData.h #includePerson.h#in.pdf
#include iostream #includeData.h #includePerson.h#in.pdf
annucommunication1
 
Testing javascript in the frontend
Testing javascript in the frontendTesting javascript in the frontend
Testing javascript in the frontend
Frederic CABASSUT
 
Non stop random2b
Non stop random2bNon stop random2b
Non stop random2b
phanhung20
 
Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin Compiler
Garth Gilmour
 
Introduction to Groovy
Introduction to GroovyIntroduction to Groovy
Introduction to Groovy
André Faria Gomes
 
Commencer avec le TDD
Commencer avec le TDDCommencer avec le TDD
Commencer avec le TDD
Eric Hogue
 
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Codemotion
 
Production.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdfProduction.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdf
sooryasalini
 
Kotlin / Android Update
Kotlin / Android UpdateKotlin / Android Update
Kotlin / Android Update
Garth Gilmour
 
Final_Project
Final_ProjectFinal_Project
Final_Project
DivinelyFavored
 
DeVry GSP 115 All Assignments latest
DeVry GSP 115 All Assignments latestDeVry GSP 115 All Assignments latest
DeVry GSP 115 All Assignments latest
Atifkhilji
 
Vaadin 7
Vaadin 7Vaadin 7
Vaadin 7
Joonas Lehtinen
 
Fact, Fiction, and FP
Fact, Fiction, and FPFact, Fiction, and FP
Fact, Fiction, and FP
Brian Lonsdorf
 
PHP in 2018 - Q4 - AFUP Limoges
PHP in 2018 - Q4 - AFUP LimogesPHP in 2018 - Q4 - AFUP Limoges
PHP in 2018 - Q4 - AFUP Limoges
✅ William Pinaud
 

Similar to Can you convert this code into a C++ code.pdf (20)

J slider
J sliderJ slider
J slider
 
Inheritance compiler support
Inheritance compiler supportInheritance compiler support
Inheritance compiler support
 
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docxfilesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
filesHeap.h#ifndef HEAP_H#define HEAP_H#includ.docx
 
Sbaw091006
Sbaw091006Sbaw091006
Sbaw091006
 
Symfony 4 Workshop - Limenius
Symfony 4 Workshop - LimeniusSymfony 4 Workshop - Limenius
Symfony 4 Workshop - Limenius
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
#include iostream #includeData.h #includePerson.h#in.pdf
#include iostream #includeData.h #includePerson.h#in.pdf#include iostream #includeData.h #includePerson.h#in.pdf
#include iostream #includeData.h #includePerson.h#in.pdf
 
Testing javascript in the frontend
Testing javascript in the frontendTesting javascript in the frontend
Testing javascript in the frontend
 
Non stop random2b
Non stop random2bNon stop random2b
Non stop random2b
 
Lies Told By The Kotlin Compiler
Lies Told By The Kotlin CompilerLies Told By The Kotlin Compiler
Lies Told By The Kotlin Compiler
 
Introduction to Groovy
Introduction to GroovyIntroduction to Groovy
Introduction to Groovy
 
Commencer avec le TDD
Commencer avec le TDDCommencer avec le TDD
Commencer avec le TDD
 
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017
 
Production.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdfProduction.javapublic class Production {    Declaring instance.pdf
Production.javapublic class Production {    Declaring instance.pdf
 
Kotlin / Android Update
Kotlin / Android UpdateKotlin / Android Update
Kotlin / Android Update
 
Final_Project
Final_ProjectFinal_Project
Final_Project
 
DeVry GSP 115 All Assignments latest
DeVry GSP 115 All Assignments latestDeVry GSP 115 All Assignments latest
DeVry GSP 115 All Assignments latest
 
Vaadin 7
Vaadin 7Vaadin 7
Vaadin 7
 
Fact, Fiction, and FP
Fact, Fiction, and FPFact, Fiction, and FP
Fact, Fiction, and FP
 
PHP in 2018 - Q4 - AFUP Limoges
PHP in 2018 - Q4 - AFUP LimogesPHP in 2018 - Q4 - AFUP Limoges
PHP in 2018 - Q4 - AFUP Limoges
 

More from FORTUNE2505

Why would a manager be concerned with bandwidth How is bandwidth me.pdf
Why would a manager be concerned with bandwidth How is bandwidth me.pdfWhy would a manager be concerned with bandwidth How is bandwidth me.pdf
Why would a manager be concerned with bandwidth How is bandwidth me.pdf
FORTUNE2505
 
Where would the Internet be today if the UNIX operating system did n.pdf
Where would the Internet be today if the UNIX operating system did n.pdfWhere would the Internet be today if the UNIX operating system did n.pdf
Where would the Internet be today if the UNIX operating system did n.pdf
FORTUNE2505
 
What do you understand by degrees of Data AbstractionSolution.pdf
What do you understand by degrees of Data AbstractionSolution.pdfWhat do you understand by degrees of Data AbstractionSolution.pdf
What do you understand by degrees of Data AbstractionSolution.pdf
FORTUNE2505
 
validity. (The Case lulTTtuT 2. Discuss the Economics of Effective Ma.pdf
validity. (The Case lulTTtuT 2. Discuss the Economics of Effective Ma.pdfvalidity. (The Case lulTTtuT 2. Discuss the Economics of Effective Ma.pdf
validity. (The Case lulTTtuT 2. Discuss the Economics of Effective Ma.pdf
FORTUNE2505
 
Twitter had their IPO in 2013. Which of the following is not accurate.pdf
Twitter had their IPO in 2013. Which of the following is not accurate.pdfTwitter had their IPO in 2013. Which of the following is not accurate.pdf
Twitter had their IPO in 2013. Which of the following is not accurate.pdf
FORTUNE2505
 
Use C programmingMake sure everything works only upload.pdf
Use C programmingMake sure everything works only upload.pdfUse C programmingMake sure everything works only upload.pdf
Use C programmingMake sure everything works only upload.pdf
FORTUNE2505
 
The Adventures of Huckleberry Finn was published twenty years after .pdf
The Adventures of Huckleberry Finn was published twenty years after .pdfThe Adventures of Huckleberry Finn was published twenty years after .pdf
The Adventures of Huckleberry Finn was published twenty years after .pdf
FORTUNE2505
 
Step 1 You work for Thunderduck Custom Tables Inc. This is the first.pdf
Step 1 You work for Thunderduck Custom Tables Inc. This is the first.pdfStep 1 You work for Thunderduck Custom Tables Inc. This is the first.pdf
Step 1 You work for Thunderduck Custom Tables Inc. This is the first.pdf
FORTUNE2505
 
Researchers argue about whether Oldowan toolmakers were hunters or s.pdf
Researchers argue about whether Oldowan toolmakers were hunters or s.pdfResearchers argue about whether Oldowan toolmakers were hunters or s.pdf
Researchers argue about whether Oldowan toolmakers were hunters or s.pdf
FORTUNE2505
 
In Aristotles Poetics he speaks of epics and tragedies. How do.pdf
In Aristotles Poetics he speaks of epics and tragedies. How do.pdfIn Aristotles Poetics he speaks of epics and tragedies. How do.pdf
In Aristotles Poetics he speaks of epics and tragedies. How do.pdf
FORTUNE2505
 
Name the type of chemical messenger is released from the axon termina.pdf
Name the type of chemical messenger is released from the axon termina.pdfName the type of chemical messenger is released from the axon termina.pdf
Name the type of chemical messenger is released from the axon termina.pdf
FORTUNE2505
 
Marilee Jones, the former dean of admissions of the Massachusetts In.pdf
Marilee Jones, the former dean of admissions of the Massachusetts In.pdfMarilee Jones, the former dean of admissions of the Massachusetts In.pdf
Marilee Jones, the former dean of admissions of the Massachusetts In.pdf
FORTUNE2505
 
Know how the complement of mRNAs in a cell can be assayed (in plants.pdf
Know how the complement of mRNAs in a cell can be assayed (in plants.pdfKnow how the complement of mRNAs in a cell can be assayed (in plants.pdf
Know how the complement of mRNAs in a cell can be assayed (in plants.pdf
FORTUNE2505
 
In Module 5 the you are here slide indicates we are currently in.pdf
In Module 5 the you are here slide indicates we are currently in.pdfIn Module 5 the you are here slide indicates we are currently in.pdf
In Module 5 the you are here slide indicates we are currently in.pdf
FORTUNE2505
 
Identify the role you believe mobile devices have on email investiga.pdf
Identify the role you believe mobile devices have on email investiga.pdfIdentify the role you believe mobile devices have on email investiga.pdf
Identify the role you believe mobile devices have on email investiga.pdf
FORTUNE2505
 
I need to implement in c++ this non-List member function void print.pdf
I need to implement in c++ this non-List member function void print.pdfI need to implement in c++ this non-List member function void print.pdf
I need to implement in c++ this non-List member function void print.pdf
FORTUNE2505
 
I have another assignment due for an advance java programming class .pdf
I have another assignment due for an advance java programming class .pdfI have another assignment due for an advance java programming class .pdf
I have another assignment due for an advance java programming class .pdf
FORTUNE2505
 
4. Real gross domestic prodact A. measures the value of fimal goods a.pdf
4. Real gross domestic prodact A. measures the value of fimal goods a.pdf4. Real gross domestic prodact A. measures the value of fimal goods a.pdf
4. Real gross domestic prodact A. measures the value of fimal goods a.pdf
FORTUNE2505
 
Hypothesis What is your hypothesis for the genetic characteristi.pdf
Hypothesis  What is your hypothesis for the genetic characteristi.pdfHypothesis  What is your hypothesis for the genetic characteristi.pdf
Hypothesis What is your hypothesis for the genetic characteristi.pdf
FORTUNE2505
 
How is a process shown in a DFD(data flow diagramSolution Data.pdf
How is a process shown in a DFD(data flow diagramSolution  Data.pdfHow is a process shown in a DFD(data flow diagramSolution  Data.pdf
How is a process shown in a DFD(data flow diagramSolution Data.pdf
FORTUNE2505
 

More from FORTUNE2505 (20)

Why would a manager be concerned with bandwidth How is bandwidth me.pdf
Why would a manager be concerned with bandwidth How is bandwidth me.pdfWhy would a manager be concerned with bandwidth How is bandwidth me.pdf
Why would a manager be concerned with bandwidth How is bandwidth me.pdf
 
Where would the Internet be today if the UNIX operating system did n.pdf
Where would the Internet be today if the UNIX operating system did n.pdfWhere would the Internet be today if the UNIX operating system did n.pdf
Where would the Internet be today if the UNIX operating system did n.pdf
 
What do you understand by degrees of Data AbstractionSolution.pdf
What do you understand by degrees of Data AbstractionSolution.pdfWhat do you understand by degrees of Data AbstractionSolution.pdf
What do you understand by degrees of Data AbstractionSolution.pdf
 
validity. (The Case lulTTtuT 2. Discuss the Economics of Effective Ma.pdf
validity. (The Case lulTTtuT 2. Discuss the Economics of Effective Ma.pdfvalidity. (The Case lulTTtuT 2. Discuss the Economics of Effective Ma.pdf
validity. (The Case lulTTtuT 2. Discuss the Economics of Effective Ma.pdf
 
Twitter had their IPO in 2013. Which of the following is not accurate.pdf
Twitter had their IPO in 2013. Which of the following is not accurate.pdfTwitter had their IPO in 2013. Which of the following is not accurate.pdf
Twitter had their IPO in 2013. Which of the following is not accurate.pdf
 
Use C programmingMake sure everything works only upload.pdf
Use C programmingMake sure everything works only upload.pdfUse C programmingMake sure everything works only upload.pdf
Use C programmingMake sure everything works only upload.pdf
 
The Adventures of Huckleberry Finn was published twenty years after .pdf
The Adventures of Huckleberry Finn was published twenty years after .pdfThe Adventures of Huckleberry Finn was published twenty years after .pdf
The Adventures of Huckleberry Finn was published twenty years after .pdf
 
Step 1 You work for Thunderduck Custom Tables Inc. This is the first.pdf
Step 1 You work for Thunderduck Custom Tables Inc. This is the first.pdfStep 1 You work for Thunderduck Custom Tables Inc. This is the first.pdf
Step 1 You work for Thunderduck Custom Tables Inc. This is the first.pdf
 
Researchers argue about whether Oldowan toolmakers were hunters or s.pdf
Researchers argue about whether Oldowan toolmakers were hunters or s.pdfResearchers argue about whether Oldowan toolmakers were hunters or s.pdf
Researchers argue about whether Oldowan toolmakers were hunters or s.pdf
 
In Aristotles Poetics he speaks of epics and tragedies. How do.pdf
In Aristotles Poetics he speaks of epics and tragedies. How do.pdfIn Aristotles Poetics he speaks of epics and tragedies. How do.pdf
In Aristotles Poetics he speaks of epics and tragedies. How do.pdf
 
Name the type of chemical messenger is released from the axon termina.pdf
Name the type of chemical messenger is released from the axon termina.pdfName the type of chemical messenger is released from the axon termina.pdf
Name the type of chemical messenger is released from the axon termina.pdf
 
Marilee Jones, the former dean of admissions of the Massachusetts In.pdf
Marilee Jones, the former dean of admissions of the Massachusetts In.pdfMarilee Jones, the former dean of admissions of the Massachusetts In.pdf
Marilee Jones, the former dean of admissions of the Massachusetts In.pdf
 
Know how the complement of mRNAs in a cell can be assayed (in plants.pdf
Know how the complement of mRNAs in a cell can be assayed (in plants.pdfKnow how the complement of mRNAs in a cell can be assayed (in plants.pdf
Know how the complement of mRNAs in a cell can be assayed (in plants.pdf
 
In Module 5 the you are here slide indicates we are currently in.pdf
In Module 5 the you are here slide indicates we are currently in.pdfIn Module 5 the you are here slide indicates we are currently in.pdf
In Module 5 the you are here slide indicates we are currently in.pdf
 
Identify the role you believe mobile devices have on email investiga.pdf
Identify the role you believe mobile devices have on email investiga.pdfIdentify the role you believe mobile devices have on email investiga.pdf
Identify the role you believe mobile devices have on email investiga.pdf
 
I need to implement in c++ this non-List member function void print.pdf
I need to implement in c++ this non-List member function void print.pdfI need to implement in c++ this non-List member function void print.pdf
I need to implement in c++ this non-List member function void print.pdf
 
I have another assignment due for an advance java programming class .pdf
I have another assignment due for an advance java programming class .pdfI have another assignment due for an advance java programming class .pdf
I have another assignment due for an advance java programming class .pdf
 
4. Real gross domestic prodact A. measures the value of fimal goods a.pdf
4. Real gross domestic prodact A. measures the value of fimal goods a.pdf4. Real gross domestic prodact A. measures the value of fimal goods a.pdf
4. Real gross domestic prodact A. measures the value of fimal goods a.pdf
 
Hypothesis What is your hypothesis for the genetic characteristi.pdf
Hypothesis  What is your hypothesis for the genetic characteristi.pdfHypothesis  What is your hypothesis for the genetic characteristi.pdf
Hypothesis What is your hypothesis for the genetic characteristi.pdf
 
How is a process shown in a DFD(data flow diagramSolution Data.pdf
How is a process shown in a DFD(data flow diagramSolution  Data.pdfHow is a process shown in a DFD(data flow diagramSolution  Data.pdf
How is a process shown in a DFD(data flow diagramSolution Data.pdf
 

Recently uploaded

Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
simonomuemu
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
Jean Carlos Nunes Paixão
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
Peter Windle
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
Kavitha Krishnan
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
Celine George
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 

Recently uploaded (20)

Smart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICTSmart-Money for SMC traders good time and ICT
Smart-Money for SMC traders good time and ICT
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
A Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdfA Independência da América Espanhola LAPBOOK.pdf
A Independência da América Espanhola LAPBOOK.pdf
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
A Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in EducationA Strategic Approach: GenAI in Education
A Strategic Approach: GenAI in Education
 
Assessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptxAssessment and Planning in Educational technology.pptx
Assessment and Planning in Educational technology.pptx
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17How to Fix the Import Error in the Odoo 17
How to Fix the Import Error in the Odoo 17
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 
Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.Types of Herbal Cosmetics its standardization.
Types of Herbal Cosmetics its standardization.
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 

Can you convert this code into a C++ code.pdf

  • 1. Can you convert this code into a C++ code? //////////////////////////////////////////// DVD.java package movie; public class DVD { private String movieTitle; private String movieStars[]; private String movieDirector; private String movieProducer; private String movieProductionCo; private int numberOfCopies; DVD(String title, String[] stars, String director, String producer, String production, int copies) { movieTitle = title; movieStars = stars; movieDirector = director; movieProducer = producer; movieProductionCo = production; numberOfCopies = copies; } public String getMovieTitle() { return movieTitle; } public void setMovieTitle(String movieTitle) { this.movieTitle = movieTitle; } public String[] getMovieStars() { return movieStars; } public void setMovieStars(String[] movieStars) { this.movieStars = movieStars; } public String getMovieDirector() {
  • 2. return movieDirector; } public void setMovieDirector(String movieDirector) { this.movieDirector = movieDirector; } public String getMovieProducer() { return movieProducer; } public void setMovieProducer(String movieProducer) { this.movieProducer = movieProducer; } public String getMovieProductionCo() { return movieProductionCo; } public void setMovieProductionCo(String movieProductionCo) { this.movieProductionCo = movieProductionCo; } public int getNumberOfCopies() { return numberOfCopies; } public void setNumberOfCopies(int numberOfCopies) { this.numberOfCopies = numberOfCopies; } public void incrementCopies() { numberOfCopies++; } public boolean checkOut() { if(numberOfCopies>0) { numberOfCopies--; return true; } else return false;
  • 3. } public void checkIn() { numberOfCopies++; } @Override public String toString() { return "Movie: " + movieTitle + ", Stars: " + movieStars[0] + " and " + movieStars[1] + ", Director: " + movieDirector + ", Producer: " + movieProducer + ", Production Company: "+movieProductionCo; } } PersonType.java package movie; public class PersonType { private String firstName; private String lastName; PersonType(String firstName, String lastName) { this.firstName = firstName; this.lastName = lastName; } public String getFirstName() { return firstName; } public void setFirstName(String firstName) { this.firstName = firstName; } public String getLastName() { return lastName; } public void setLastName(String lastName) { this.lastName = lastName;
  • 4. } } Customer.java package movie; import java.util.ArrayList; import java.util.List; public class Customer extends PersonType{ List rentedDVDs; List rentalCount; int accountNumber; private static int counter = 1001; Customer(String firstName, String lastName) { super(firstName, lastName); rentedDVDs = new ArrayList(); rentalCount = new ArrayList(); accountNumber = counter++; } public int getAccountNumber() { return accountNumber; } public String getName() { return getFirstName() + " " + getLastName(); } public void setName(String firstName, String lastName) { setFirstName(firstName); setLastName(lastName); }
  • 5. public void rentDVD(DVD dvd) { for(int i=0; i1) rentalCount.set(i, rentalCount.get(i)-1); else if(rentalCount.get(i)==1) { rentalCount.remove(i); rentedDVDs.remove(i); } return; } } System.out.println("The DVD was not rented to the customer !"); } public int rentalCount() { int total = 0; for(int i: rentalCount) total += i; return total; } @Override public String toString() { return "Customer Name : " + getName() + "Account Number: " + accountNumber + "Total rental Count: " + rentalCount(); } } DVDStore.java package movie; import java.util.ArrayList; import java.util.List; public class DVDStore { List listOfDVDs;
  • 6. List customers; DVDStore() { listOfDVDs = new ArrayList(); customers = new ArrayList(); } public void addDVD(DVD newdvd) { DVD dvd = searchDVD(newdvd.getMovieTitle()); if(dvd == null) { listOfDVDs.add(newdvd); } else listOfDVDs.get(listOfDVDs.indexOf(newdvd)).incrementCopies(); } public void addCustomer(Customer customer) { customers.add(customer); } public DVD searchDVD(String title) { DVD dvd = null; for(DVD currentDVD: listOfDVDs) { if(currentDVD.getMovieTitle().equals(title)) { dvd = currentDVD; } } return dvd; }
  • 7. private int findCustomer(int accountNumber) { for(int i=0; i0) System.out.println(title + " is in stock"); } menu(store); break; case 5:store.printMovieTitles(); menu(store); break; case 6: store.printAllDVDs(); menu(store); break; case 9: return; } } public static void main(String[] args) { DVDStore store = new DVDStore(); try { Scanner filereader = new Scanner(new File("movies.txt")); while(filereader.hasNextLine()) { String title = filereader.nextLine().replace("DVD ", ""); String star1 = filereader.nextLine().replace("movie ", ""); String star2 = filereader.nextLine().replace("movie ", ""); String producer = filereader.nextLine().replace("movie ", ""); String director = filereader.nextLine().replace("movie ", ""); String production = filereader.nextLine().replace("movie ", ""); String copies = filereader.nextLine(); store.addDVD(new DVD(title, new String[]{star1, star2}, director, producer, production, Integer.valueOf(copies))); } } catch (FileNotFoundException e) { System.out.println("File format is wrong !");
  • 8. e.printStackTrace(); } System.out.println("Enter a customer first name: "); Scanner consoleReader = new Scanner(System.in); String fName = consoleReader.next(); System.out.println("Enter a customer last name: "); String lname = consoleReader.next(); Customer customer = new Customer(fName, lname); store.addCustomer(customer); menu(store); } } Solution main.cpp #include #include #include #include "dvdType.h" #include "dvdListType.h" using namespace std; void createDVDList(ifstream& infile, dvdListType& dvdList); void displayMenu(); int main() { dvdListType dvdList; int choice; char ch; string title; ifstream infile; //open the input file infile.open("dvdDat.txt");
  • 9. if (!infile) { cout << "The input file does not exist. " << "The program terminates!!!" << endl; return 1; } //create the DVD list createDVDList(infile, dvdList); infile.close(); //show the menu displayMenu(); cout << "Enter your choice: "; cin >> choice; //get the request cin.get(ch); cout << endl; //process the requests while (choice != 9) { switch (choice) { case 1: cout << "Enter the title: "; getline(cin, title); cout << endl; if (dvdList.dvdSearch(title)) cout << "The store carries " << title << endl; else cout << "The store does not carry " << title << endl; break; case 2: cout << "Enter the title: "; getline(cin, title); cout << endl; if (dvdList.dvdSearch(title))
  • 10. { if (dvdList.isDVDAvailable(title)) { dvdList.dvdCheckOut(title); cout << "Enjoy your movie: " << title << endl; } else cout << "Currently " << title << " is out of stock." << endl; } else cout << "The store does not carry " << title << endl; break; case 3: cout << "Enter the title: "; getline(cin, title); cout << endl; if (dvdList.dvdSearch(title)) { dvdList.dvdCheckIn(title); cout << "Thanks for returning " << title << endl; } else cout << "The store does not carry " << title << endl; break; case 4: cout << "Enter the title: "; getline(cin, title); cout << endl; if (dvdList.dvdSearch(title)) { if (dvdList.isDVDAvailable(title))
  • 11. cout << title << " is currently in " << "stock." << endl; else cout << title << " is currently out " << "of stock." << endl; } else cout << "The store does not carry " << title << endl; break; case 5: dvdList.dvdPrintTitle(); break; case 6: dvdList.print(); break; default: cout << "Invalid selection." << endl; }//end switch displayMenu(); //display menu cout << "Enter your choice: "; cin >> choice; //get the next request cin.get(ch); cout << endl; }//end while return 0; } void createDVDList(ifstream& infile, dvdListType& dvdList) { string title; string star1; string star2; string producer; string director; string productionCo;
  • 12. char ch; int inStock; dvdType newDVD; getline(infile, title); while (infile) { getline(infile, star1); getline(infile, star2); getline(infile, producer); getline(infile, director); getline(infile, productionCo); infile >> inStock; infile.get(ch); newDVD.setDVDInfo(title, star1, star2, producer, director, productionCo, inStock); dvdList.insertFirst(newDVD); getline(infile, title); }//end while }//end createDVDList void displayMenu() { cout << "Select one of the following:" << endl; cout << "1: To check whether the store carries a " << "particular DVD." << endl; cout << "2: To check out a DVD." << endl; cout << "3: To check in a DVD." << endl; cout << "4: To check whether a particular DVD is " << "in stock." << endl; cout << "5: To print only the titles of all the DVDs." << endl; cout << "6: To print a list of all the DVDs." << endl; cout << "9: To exit" << endl; } //end displayMenu dvdListType.h #ifndef H_DVDLinkedListType
  • 13. #define H_DVDLinkedListType #include #include "unorderedLinkedList.h" #include "dvdType.h" using namespace std; class dvdListType:public unorderedLinkedList { public: bool dvdSearch(string title) const; bool isDVDAvailable(string title) const; void dvdCheckOut(string title); void dvdCheckIn(string title); bool dvdCheckTitle(string title) const; void dvdUpdateInStock(string title, int num); void dvdSetCopiesInStock(string title, int num); void dvdPrintTitle() const; private: void searchDVDList(string title, bool& found, nodeType* &current) const; }; #endif dvdListTypeImp.cpp #include #include #include "dvdListType.h" using namespace std; void dvdListType::searchDVDList(string title, bool& found, nodeType* &current) const { found = false; //set found to false current = first; //set current to point to the first node
  • 14. //in the list while (current != nullptr && !found) //search the list if (current->info.checkTitle(title)) //the item is found found = true; else current = current->link; //advance current to //the next node }//end searchDVDList bool dvdListType::isDVDAvailable(string title) const { bool found; nodeType *location; searchDVDList(title, found, location); if (found) found = (location->info.getNoOfCopiesInStock() > 0); else found = false; return found; } void dvdListType::dvdCheckIn(string title) { bool found = false; nodeType *location; searchDVDList(title, found, location); //search the list if (found) location->info.checkIn(); else cout << "The store does not carry " << title << endl; } void dvdListType::dvdCheckOut(string title) { bool found = false; nodeType *location; searchDVDList(title, found, location); //search the list if (found)
  • 15. location->info.checkOut(); else cout << "The store does not carry " << title << endl; } bool dvdListType::dvdCheckTitle(string title) const { bool found = false; nodeType *location; searchDVDList(title, found, location); //search the list return found; } void dvdListType::dvdUpdateInStock(string title, int num) { bool found = false; nodeType *location; searchDVDList(title, found, location); //search the list if (found) location->info.updateInStock(num); else cout << "The store does not carry " << title << endl; } void dvdListType::dvdSetCopiesInStock(string title, int num) { bool found = false; nodeType *location; searchDVDList(title, found, location); if (found) location->info.setCopiesInStock(num); else cout << "The store does not carry " << title << endl; } bool dvdListType::dvdSearch(string title) const
  • 16. { bool found = false; nodeType *location; searchDVDList(title, found, location); return found; } void dvdListType::dvdPrintTitle() const { nodeType* current; current = first; while (current != nullptr) { current->info.printTitle(); current = current->link; } } dvdType.h #ifndef H_dvdType #define H_dvdType #include #include using namespace std; class dvdType { friend ostream& operator<< (ostream&, const dvdType&); public: void setDVDInfo(string title, string star1, string star2, string producer, string director, string productionCo, int setInStock); int getNoOfCopiesInStock() const; void checkOut(); void checkIn(); void printTitle() const; void printInfo() const;
  • 17. bool checkTitle(string title); void updateInStock(int num); void setCopiesInStock(int num); string getTitle() const; dvdType(string title = "", string star1 = "", string star2 = "", string producer = "", string director = "", string productionCo = "", int setInStock = 0); //Overload the relational operators. bool operator==(const dvdType&) const; bool operator!=(const dvdType&) const; private: string dvdTitle; //variable to store the name //of the movie string movieStar1; //variable to store the name //of the star string movieStar2; //variable to store the name //of the star string movieProducer; //variable to store the name //of the producer string movieDirector; //variable to store the name //of the director string movieProductionCo; //variable to store the name //of the production company int copiesInStock; //variable to store the number of //copies in stock }; #endif dvdTypeImp.cpp #include #include #include "dvdType.h" using namespace std; void dvdType::setDVDInfo(string title, string star1,
  • 18. string star2, string producer, string director, string productionCo, int setInStock) { dvdTitle = title; movieStar1 = star1; movieStar2 = star2; movieProducer = producer; movieDirector = director; movieProductionCo = productionCo; copiesInStock = setInStock; } void dvdType::checkOut() { if (getNoOfCopiesInStock() > 0) copiesInStock--; else cout << "Currently out of stock" << endl; } void dvdType::checkIn() { copiesInStock++; } int dvdType::getNoOfCopiesInStock() const { return copiesInStock; } void dvdType::printTitle() const { cout << "DVD Title: " << dvdTitle << endl; } void dvdType::printInfo() const { cout << "DVD Title: " << dvdTitle << endl; cout << "Stars: " << movieStar1 << " and "
  • 19. << movieStar2 << endl; cout << "Producer: " << movieProducer << endl; cout << "Director: " << movieDirector << endl; cout << "Production Company: " << movieProductionCo << endl; cout << "Copies in stock: " << copiesInStock << endl; } bool dvdType::checkTitle(string title) { return(dvdTitle == title); } void dvdType::updateInStock(int num) { copiesInStock += num; } void dvdType::setCopiesInStock(int num) { copiesInStock = num; } string dvdType::getTitle() const { return dvdTitle; } dvdType::dvdType(string title, string star1, string star2, string producer, string director, string productionCo, int setInStock) { setDVDInfo(title, star1, star2, producer, director, productionCo, setInStock); } bool dvdType::operator==(const dvdType& other) const { return (dvdTitle == other.dvdTitle); }
  • 20. bool dvdType::operator!=(const dvdType& other) const { return (dvdTitle != other.dvdTitle); } ostream& operator<< (ostream& osObject, const dvdType& dvd) { osObject << endl; osObject << "DVD Title: " << dvd.dvdTitle << endl; osObject << "Stars: " << dvd.movieStar1 << " and " << dvd.movieStar2 << endl; osObject << "Producer: " << dvd.movieProducer << endl; osObject << "Director: " << dvd.movieDirector << endl; osObject << "Production Company: " << dvd.movieProductionCo << endl; osObject << "Copies in stock: " << dvd.copiesInStock << endl; osObject << "_____________________________________" << endl; return osObject; } linkedList.h #ifndef H_LinkedListType #define H_LinkedListType #include #include using namespace std; //Definition of the node template struct nodeType { Type info; nodeType *link; }; template class linkedListIterator
  • 21. { public: linkedListIterator(); linkedListIterator(nodeType *ptr); Type operator*(); linkedListIterator operator++(); bool operator==(const linkedListIterator& right) const; bool operator!=(const linkedListIterator& right) const; private: nodeType *current; //pointer to point to the current //node in the linked list }; template linkedListIterator::linkedListIterator() { current = nullptr; } template linkedListIterator:: linkedListIterator(nodeType *ptr) { current = ptr; } template Type linkedListIterator::operator*() { return current->info; } template linkedListIterator linkedListIterator::operator++() { current = current->link; return *this; } template bool linkedListIterator::operator==
  • 22. (const linkedListIterator& right) const { return (current == right.current); } template bool linkedListIterator::operator!= (const linkedListIterator& right) const { return (current != right.current); } template class linkedListType { public: const linkedListType& operator= (const linkedListType&); void initializeList(); bool isEmptyList() const; void print() const; int length() const; void destroyList(); Type front() const; Type back() const; virtual bool search(const Type& searchItem) const = 0; virtual void insertFirst(const Type& newItem) = 0; virtual void insertLast(const Type& newItem) = 0; virtual void deleteNode(const Type& deleteItem) = 0; linkedListIterator begin(); linkedListIterator end(); linkedListType(); linkedListType(const linkedListType& otherList); //copy constructor ~linkedListType(); protected: int count; //variable to store the number of //elements in the list nodeType *first; //pointer to the first node of the list
  • 23. nodeType *last; //pointer to the last node of the list private: void copyList(const linkedListType& otherList); }; template bool linkedListType::isEmptyList() const { return(first == nullptr); } template linkedListType::linkedListType() //default constructor { first = nullptr; last = nullptr; count = 0; } template void linkedListType::destroyList() { nodeType *temp; //pointer to deallocate the memory //occupied by the node while (first != nullptr) //while there are nodes in the list { temp = first; //set temp to the current node first = first->link; //advance first to the next node delete temp; //deallocate the memory occupied by temp } last = nullptr; //initialize last to nullptr; first has already //been set to nullptr by the while loop count = 0; } template void linkedListType::initializeList() { destroyList(); //if the list has any nodes, delete them
  • 24. } template void linkedListType::print() const { nodeType *current; //pointer to traverse the list current = first; //set current so that it points to //the first node while (current != nullptr) //while more data to print { cout << current->info << " "; current = current->link; } }//end print template int linkedListType::length() const { return count; } //end length template Type linkedListType::front() const { assert(first != nullptr); return first->info; //return the info of the first node }//end front template Type linkedListType::back() const { assert(last != nullptr); return last->info; //return the info of the last node }//end back template linkedListIterator linkedListType::begin() { linkedListIterator temp(first); return temp; }
  • 25. template linkedListIterator linkedListType::end() { linkedListIterator temp(nullptr); return temp; } template void linkedListType::copyList (const linkedListType& otherList) { nodeType *newNode; //pointer to create a node nodeType *current; //pointer to traverse the list if (first != nullptr) //if the list is nonempty, make it empty destroyList(); if (otherList.first == nullptr) //otherList is empty { first = nullptr; last = nullptr; count = 0; } else { current = otherList.first; //current points to the //list to be copied count = otherList.count; //copy the first node first = new nodeType; //create the node first->info = current->info; //copy the info first->link = nullptr; //set the link field of //the node to nullptr last = first; //make last point to the //first node current = current->link; //make current point to //the next node //copy the remaining list while (current != nullptr)
  • 26. { newNode = new nodeType; //create a node newNode->info = current->info; //copy the info newNode->link = nullptr; //set the link of //newNode to nullptr last->link = newNode; //attach newNode after last last = newNode; //make last point to //the actual last node current = current->link; //make current point //to the next node }//end while }//end else }//end copyList template linkedListType::~linkedListType() //destructor { destroyList(); }//end destructor template linkedListType::linkedListType (const linkedListType& otherList) { first = nullptr; copyList(otherList); }//end copy constructor //overload the assignment operator template const linkedListType& linkedListType::operator= (const linkedListType& otherList) { if (this != &otherList) //avoid self-copy { copyList(otherList); }//end else return *this; }
  • 27. #endif unorderedLinkedList.h #ifndef H_UnorderedLinkedList #define H_UnorderedLinkedList #include "linkedList.h" using namespace std; template class unorderedLinkedList: public linkedListType { public: bool search(const Type& searchItem) const; //Function to determine whether searchItem is in the list. //Postcondition: Returns true if searchItem is in the // list, otherwise the value false is // returned. void insertFirst(const Type& newItem); void insertLast(const Type& newItem); void deleteNode(const Type& deleteItem); }; template bool unorderedLinkedList:: search(const Type& searchItem) const { nodeType *current; //pointer to traverse the list bool found = false; current = first; //set current to point to the first //node in the list while (current != nullptr && !found) //search the list if (current->info == searchItem) //searchItem is found found = true; else current = current->link; //make current point to
  • 28. //the next node return found; }//end search template void unorderedLinkedList::insertFirst(const Type& newItem) { nodeType *newNode; //pointer to create the new node newNode = new nodeType; //create the new node newNode->info = newItem; //store the new item in the node newNode->link = first; //insert newNode before first first = newNode; //make first point to the //actual first node count++; //increment count if (last == nullptr) //if the list was empty, newNode is also //the last node in the list last = newNode; }//end insertFirst template void unorderedLinkedList::insertLast(const Type& newItem) { nodeType *newNode; //pointer to create the new node newNode = new nodeType; //create the new node newNode->info = newItem; //store the new item in the node newNode->link = nullptr; //set the link field of newNode //to nullptr if (first == nullptr) //if the list is empty, newNode is //both the first and last node { first = newNode; last = newNode; count++; //increment count } else //the list is not empty, insert newNode after last { last->link = newNode; //insert newNode after last last = newNode; //make last point to the actual
  • 29. //last node in the list count++; //increment count } }//end insertLast template void unorderedLinkedList::deleteNode(const Type& deleteItem) { nodeType *current; //pointer to traverse the list nodeType *trailCurrent; //pointer just before current bool found; if (first == nullptr) //Case 1; the list is empty. cout << "Cannot delete from an empty list." << endl; else { if (first->info == deleteItem) //Case 2 { current = first; first = first->link; count--; if (first == nullptr) //the list has only one node last = nullptr; delete current; } else //search the list for the node with the given info { found = false; trailCurrent = first; //set trailCurrent to point //to the first node current = first->link; //set current to point to //the second node while (current != nullptr && !found) { if (current->info != deleteItem) {
  • 30. trailCurrent = current; current = current-> link; } else found = true; }//end while if (found) //Case 3; if found, delete the node { trailCurrent->link = current->link; count--; if (last == current) //node to be deleted //was the last node last = trailCurrent; //update the value //of last delete current; //delete the node from the list } else cout << "The item to be deleted is not in " << "the list." << endl; }//end else }//end else }//end deleteNode #endif dvdDat.txt Titanic Kate Winslet Leonardo DiCaprio Cameron Cameron 20th Century Fox 2 One Fine Day George Clooney Michelle Pfeiffer
  • 31. Obset Hoffman 20th Century Fox 19 Sister Act Whoopi GoldBerg Maggie Smith Schwartz Ardolino Touch Stone Pictures 14