Modify Assignment 5 toReplace the formatted output method (toStri.docxadelaidefarmer322
Modify Assignment 5 to:
Replace the formatted output method (toString) with an overloaded output/insertion operator, and modify the driver to use the overloaded operator.
Incorporate the capability to access movies by the movie number or by a search string, if this wasn't part of your Assignment 5.
Replace the getMovie(int) [or your solution equivalent] with an overloaded subscript operator ([ ]), which takes an integer and returns a Movie (or Movie reference).
Account for an invalid movie number.
HEADER FILE
// Movie.h
#ifndef MOVIE_H
#define MOVIE_H
#include
using namespace std;
class Movie {
// data is private by default
string title, studio;
long long boxOffice[3]; // World, US, non-US
short rank[3], releaseYear; // World, US, non-US
enum unit {WORLD, US, NON_US};
public:
Movie();
Movie(string);
string getTitle() const;
string getStudio() const;
long long getWorldBoxOffice() const;
long long getUSBoxOffice() const;
long long getNonUSBoxOffice() const;
int getWorldRank() const;
int getUSRank() const;
int getNonUSRank() const;
int getReleaseYear() const;
string toString() const;
private:
Movie(const Movie &); // private copy constructor blocks invocation
};
#endif
HEADER FILE
// Movies.h
#ifndef MOVIES_H
#define MOVIES_H
#include "Movie.h" // include Movie class definition
#include
using namespace std;
class Movies {
// data is private by default
static const int MAX_MOVIES = 1000;
Movie *movies;
short movieCnt;
public:
Movies(string);
int getMovieCount() const;
const Movie * getMovie(string, int&) const;
const Movie * getMovie(int) const;
~Movies();
private:
void loadMovies(string);
string myToLower(string) const;
void reSize();
};
#endif
CPP FILE
// MovieInfoApp.cpp
#include "Movie.h" // include Movie class definition
#include "Movies.h" // include Movies class definition
#include
#include
#include
#include
using namespace std;
void main() {
Movies movies("Box Office Mojo.txt");
if(movies.getMovieCount() > 0) {
string movieCode;
cout << "Please enter the movie search string,\nentering a leading # to retrieve by movie number"
<< "\n or a ^ to get the next movie (press Enter to exit): ";
getline(cin, movieCode);
if (movieCode.length() > 0) {
int mn = 0;
const Movie * m;
do {
if(movieCode[0] != '#' && movieCode[0] != '^')
m = movies.getMovie(movieCode, mn);
else if(movieCode[0] == '#'){ // get by number
mn = stoi(movieCode.substr(1));
m = movies.getMovie(mn);
} else if(movieCode[0] == '^') // get next movie
m = movies.getMovie(++mn);
if(m != nullptr) {
cout << m->toString() << "\n";
if(m->getWorldBoxOffice() > 0)
cout << setprecision(1) << fixed
<< "\n\tNon-US to World Ratio:\t"
<< (m->getNonUSBoxOffice() * 100.0) /
m->getWorldBoxOffice() << "%\n" << endl;
else
cout << "No ratio due to zero World Box Office\n";
} else {
cout << "\n Movie not found!\n\n" << endl;
mn = 0;
}
cout << "Please enter the movie search string,\nentering a leading.
November Camp - Spec BDD with PHPSpec 2Kacper Gunia
My slides on PHPSpec 2 from Symfony November Camp Stockholm.
www.symfony.se/november-camp/
More Domain-Driven Design related content at: https://domaincentric.net/
The document contains Java code that defines classes for managing a video game database. The VideoGame class defines the properties of a video game, including its name and console. The VideoGameManager class contains methods for loading game data from a file, searching the database by name and console, and printing results. The VideoGameCollectionFrontEnd class provides a menu interface for interacting with the database via the VideoGameManager class.
This document provides an introduction to test-driven development (TDD) and unit testing in PHP. It discusses where to start with TDD, what unit tests are, and tools to use like PHPUnit. It covers the red-green-refactor TDD cycle and topics like mocking dependencies, handling file systems and databases in tests, and continuous integration. The goal is to help PHP developers get started with TDD.
Refactoring, Agile Entwicklung, Continuous Integration – all diese für nachhaltigen Erfolg wichtigen Vorgehensweisen setzen Erfahrung mit Unit Testing voraus. Abseits von den üblichen "Bowling"-Beispielen möchten wir gerne einen Crashkurs inkl. Best Practices für das erfolgreiche Unit Testing durchführen. Anhand eines Beispielprojekts auf Basis des Zend Frameworks werden wir nach der Installation von PHPUnit auf allen Notebooks gemeinsam eine kleine Applikation aufbauen, die durchgehend Test-driven entwickelt wird.
The document discusses inheritance in Java. It introduces inheritance as a way to define subclasses that extend existing superclasses, allowing code reuse and avoiding duplication. This is demonstrated using a DoME example that stores multimedia items. The example is refactored using inheritance, with Item as the superclass of subclasses like CD and DVD. Inheritance allows polymorphic variables that can refer to objects of a class or its subclasses, following the principles of subtyping and substitution.
Modify Assignment 5 toReplace the formatted output method (toStri.docxadelaidefarmer322
Modify Assignment 5 to:
Replace the formatted output method (toString) with an overloaded output/insertion operator, and modify the driver to use the overloaded operator.
Incorporate the capability to access movies by the movie number or by a search string, if this wasn't part of your Assignment 5.
Replace the getMovie(int) [or your solution equivalent] with an overloaded subscript operator ([ ]), which takes an integer and returns a Movie (or Movie reference).
Account for an invalid movie number.
HEADER FILE
// Movie.h
#ifndef MOVIE_H
#define MOVIE_H
#include
using namespace std;
class Movie {
// data is private by default
string title, studio;
long long boxOffice[3]; // World, US, non-US
short rank[3], releaseYear; // World, US, non-US
enum unit {WORLD, US, NON_US};
public:
Movie();
Movie(string);
string getTitle() const;
string getStudio() const;
long long getWorldBoxOffice() const;
long long getUSBoxOffice() const;
long long getNonUSBoxOffice() const;
int getWorldRank() const;
int getUSRank() const;
int getNonUSRank() const;
int getReleaseYear() const;
string toString() const;
private:
Movie(const Movie &); // private copy constructor blocks invocation
};
#endif
HEADER FILE
// Movies.h
#ifndef MOVIES_H
#define MOVIES_H
#include "Movie.h" // include Movie class definition
#include
using namespace std;
class Movies {
// data is private by default
static const int MAX_MOVIES = 1000;
Movie *movies;
short movieCnt;
public:
Movies(string);
int getMovieCount() const;
const Movie * getMovie(string, int&) const;
const Movie * getMovie(int) const;
~Movies();
private:
void loadMovies(string);
string myToLower(string) const;
void reSize();
};
#endif
CPP FILE
// MovieInfoApp.cpp
#include "Movie.h" // include Movie class definition
#include "Movies.h" // include Movies class definition
#include
#include
#include
#include
using namespace std;
void main() {
Movies movies("Box Office Mojo.txt");
if(movies.getMovieCount() > 0) {
string movieCode;
cout << "Please enter the movie search string,\nentering a leading # to retrieve by movie number"
<< "\n or a ^ to get the next movie (press Enter to exit): ";
getline(cin, movieCode);
if (movieCode.length() > 0) {
int mn = 0;
const Movie * m;
do {
if(movieCode[0] != '#' && movieCode[0] != '^')
m = movies.getMovie(movieCode, mn);
else if(movieCode[0] == '#'){ // get by number
mn = stoi(movieCode.substr(1));
m = movies.getMovie(mn);
} else if(movieCode[0] == '^') // get next movie
m = movies.getMovie(++mn);
if(m != nullptr) {
cout << m->toString() << "\n";
if(m->getWorldBoxOffice() > 0)
cout << setprecision(1) << fixed
<< "\n\tNon-US to World Ratio:\t"
<< (m->getNonUSBoxOffice() * 100.0) /
m->getWorldBoxOffice() << "%\n" << endl;
else
cout << "No ratio due to zero World Box Office\n";
} else {
cout << "\n Movie not found!\n\n" << endl;
mn = 0;
}
cout << "Please enter the movie search string,\nentering a leading.
November Camp - Spec BDD with PHPSpec 2Kacper Gunia
My slides on PHPSpec 2 from Symfony November Camp Stockholm.
www.symfony.se/november-camp/
More Domain-Driven Design related content at: https://domaincentric.net/
The document contains Java code that defines classes for managing a video game database. The VideoGame class defines the properties of a video game, including its name and console. The VideoGameManager class contains methods for loading game data from a file, searching the database by name and console, and printing results. The VideoGameCollectionFrontEnd class provides a menu interface for interacting with the database via the VideoGameManager class.
This document provides an introduction to test-driven development (TDD) and unit testing in PHP. It discusses where to start with TDD, what unit tests are, and tools to use like PHPUnit. It covers the red-green-refactor TDD cycle and topics like mocking dependencies, handling file systems and databases in tests, and continuous integration. The goal is to help PHP developers get started with TDD.
Refactoring, Agile Entwicklung, Continuous Integration – all diese für nachhaltigen Erfolg wichtigen Vorgehensweisen setzen Erfahrung mit Unit Testing voraus. Abseits von den üblichen "Bowling"-Beispielen möchten wir gerne einen Crashkurs inkl. Best Practices für das erfolgreiche Unit Testing durchführen. Anhand eines Beispielprojekts auf Basis des Zend Frameworks werden wir nach der Installation von PHPUnit auf allen Notebooks gemeinsam eine kleine Applikation aufbauen, die durchgehend Test-driven entwickelt wird.
The document discusses inheritance in Java. It introduces inheritance as a way to define subclasses that extend existing superclasses, allowing code reuse and avoiding duplication. This is demonstrated using a DoME example that stores multimedia items. The example is refactored using inheritance, with Item as the superclass of subclasses like CD and DVD. Inheritance allows polymorphic variables that can refer to objects of a class or its subclasses, following the principles of subtyping and substitution.
This document describes a Javabean that allows displaying a Jslider component in an Oracle Forms application. The Javabean handles displaying the slider, setting properties like background color, and firing events when the slider value changes. It provides methods to initialize the slider, set properties like value, and get the current value. The sample Forms application demonstrates using the bean by initializing slider properties and handling value change events.
1. The document discusses various C++ concepts related to polymorphism and virtual functions including inheritance, upcasting, overriding virtual functions, pure virtual functions, virtual destructors, and operator overloading.
2. It provides code examples to demonstrate polymorphism with classes like Instrument, Wind, Pet and subclasses Dog and Cat.
3. It also shows examples of upcasting, downcasting using dynamic_cast, returning references/pointers to derived types, and ensuring proper object destruction with virtual destructors.
files/Heap.h
#ifndef HEAP_H
#define HEAP_H
#include <vector>
#include <stdexcept> // std::out_of_range
#include <math.h> // pow()
using namespace std;
template<typename T>
class Heap
{
private:
vector<T> _items; // Main vector of elements for heap storage
/**
* Used to take unsorted data and heapify it
*/
void buildHeap()
{
for (int i = _items.size() / 2; i >= 0; i--)
{
percolateDown(i);
}
}
/*********************************************************************/
/********************* Microassignment zone *************************/
/**
* Percolates the item specified at by index down
* into its proper location within a heap.
* Used for dequeue operations and array to heap conversions
* MA TODO: Implement percolateDown!
*/
void percolateDown(int index)
{
}
/**
* Percolate up from a given index to fix heap property
* Used in inserting new nodes into the heap
* MA TODO: Implement percolateUp
*/
void percolateUp( int current_position )
{
}
/************************** Microassigment zone DONE *********************/
public:
/**
* Default empty constructor
*/
Heap()
{
}
/**
* Constructor with a vector of elements
*/
Heap(const vector<T> &unsorted)
{
for (int i = 0; i < unsorted.size(); i++)
{
_items.push_back(unsorted[i]);
}
buildHeap();
}
/**
* Adds a new item to the heap
*/
void insert(T item)
{
int current_position = size(); // Get index location
_items.push_back(item); // Add data to end
percolateUp( current_position ); // Adjust up, as needed
}
/**
* Returns the top-most item in our heap without
* actually removing the item from the heap
*/
T& getFirst()
{
if( size() > 0 )
return _items[0];
else
throw std::out_of_range("No elements in Heap.");
}
/**
* Removes minimum value from heap and returns it to the caller
*/
T deleteMin()
{
int last_index = size() - 1; // Calc last item index
int root_index = 0; // Root index (for readability)
T min_item = _items[root_index]; // Keep item to return
_items[root_index] = _items[last_index]; // Move last item to root
_items.erase(_items.end() - 1); // Erase last element entry
percolateDown(0); // Fix heap property
return min_item;
}
/**
* Returns true if heap is empty, else false
*/
bool isEmpty() const
{
return _items.size() == 0;
}
/**
* Returns current quantity of elements in heap (N)
*/
int size() const
{
return _items.size();
}
/**
* Return heap data in order from the _items vector
*/
string to_s() const
{
string ret = "";
for(int i = 0; i < _items.size(); i++)
{
ret += to_string(_items[i]) + " ";
}
return ret;
}
/**
...
The document defines a class called ofBlob that represents a circle object that can be drawn and manipulated. It includes private variables to store the blob's position, dimension, speed, and phase. Methods are defined to initialize the blob, set/get its properties, update its position, and draw it. A testApp class is also defined that initializes a vector of ofBlob objects and calls their update and draw methods in a loop.
This document discusses various techniques for working with multimedia in Android applications, including detecting device capabilities, loading images from local storage and remote URLs, playing audio files from assets and raw resources, and improving performance through caching and asynchronous loading. It provides code examples for checking if a device has a front-facing camera, loading images while avoiding out of memory errors, playing audio files from assets, and using an AsyncTask to load images asynchronously to avoid blocking the UI. It also discusses potential memory leak issues and strategies for building an image cache.
The document discusses test-driven development (TDD) and how to test JavaScript code from a frontend perspective. It goes through the TDD cycle of writing a failing test first, then just enough code to pass the test, and refactoring. It provides examples testing user interaction, DOM manipulation, and mocking methods like Date and browser APIs. The goal is to write tests for all aspects of a date picker component, including showing/hiding on focus/click and adding a "selected" class. Tips provided include finding bugs to write tests for, pairing during TDD, using web APIs in tests, and not testing the browser itself.
This document provides instructions for using a web page to play YouTube videos in a random, continuous playlist. It includes:
1) Directions to download and view the web page files in a browser.
2) An explanation of the web page's functions like playing all videos, adding new videos, and saving an updated playlist.
3) An overview of the programming and JavaScript functions used to retrieve video data and play videos randomly.
The document discusses how the Kotlin compiler fakes or lies about certain Kotlin language features by decompiling the bytecode produced by the Kotlin compiler. It provides examples of how free functions, nested functions, primary constructors, extension methods, destructuring, object declarations, companion objects, enumerations, delegated properties, lambdas with receivers, and more are implemented under the hood by the compiler through bytecode tricks and deception. The document is intended to look under the hood of the Kotlin compiler and Java bytecode to understand how certain Kotlin features are implemented that don't have a direct mapping to Java.
Groovy is a dynamic language for the Java platform that provides features inspired by languages like Python, Ruby and Smalltalk. It allows Java developers to use these features with a syntax that is very similar to Java. Groovy code can be compiled to Java bytecode and integrated with Java applications and libraries. It supports features like closures, metaprogramming, builders and templates to improve developer productivity.
Talk given in French at ConFoo 2015
Le TDD (Test Driven Development) gagne en popularité dans la communauté PHP. C’est maintenant une pratique accepté. Mais commencer peut sembler difficile.
Dans cette session, nous allons voir ce qu’est le TDD. Nous allons commencer par voir les principes. Puis les outils utilisés, et comment s’en servir au quotidien. Nous allons aussi voir les difficultés souvent rencontrées et comment les contourner.
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Codemotion
Dopo 20 anni Java inizia a sentire il peso degli anni e la sua sintassi non evolve come vorremmo, ma la JVM resta sempre un ambiente affidabile ed è già in produzione presso moltissime aziende. Negli ultimi anni sono usciti molti linguaggi basati sulla JVM, ma non tutti hanno avuto il successo sperato. Kotlin ha conquistato Android e, ora, grazie a una sintassi intuitiva e grandi aziende che lo supportano potrebbe essere molto utilizzato anche nelle applicazioni web. Durante il talk vedremo le basi del linguaggio e come sviluppare una applicazione web pronta ad andare in produzione.
Production.javapublic class Production { Declaring instance.pdfsooryasalini
The document defines classes for different types of productions - Production, Film, Play, and Musical. Production is the parent class that defines common properties like title, director, writer. Child classes like Film add properties specific to that type - box office gross for Film. The main method creates objects of each type and prints their details.
The document discusses various Kotlin language features and how they are compiled down to bytecode. It explains concepts like lowering, de-sugaring, and decompiling Kotlin programs. Specific language features summarized include free functions, nested functions, extension methods, data classes, object declarations, companion objects, and lambdas with receivers. The document shows how each feature compiles by decompiling example Kotlin code.
This program was designed by Cheriqua Tate to help an engineering company track customers and contractors for pool and hot tub projects. It contains panels to calculate pool and hot tub volumes, convert temperatures and lengths, and add/view customer and contractor information stored in text files. The main class initializes a tabbed pane interface containing panels for these different functions.
Just Click on Below Link to Download This Course:
https://www.devrycoursehelp.com/product/devry-gsp-115-all-assignments-latest/
DeVry GSP 115 All Assignments latest
DeVry GSP 115 Week 1 Assignment latest
Week 1: Simple Data Types
Instructions
Complete the following assignments. Cut and paste your finished code into a Word document, clearly identifying which assignment it is. Also, capture the output of the program and paste that into the Word document. If there are questions to be answered, put the answers after the output. When you complete all three of this week’s assignments, save the document as yourLastName_GSP115_W1_Assignments.docx. Submit it to the Week 1 assignment Dropbox.
Vaadin 7 is an open source web application framework that allows developers to build rich client-side web applications using Java on the server-side and JavaScript on the client-side, with new features in Vaadin 7 including improved component architecture, support for SASS styling, and enhanced widget communication through state-based RPC.
This document provides examples of functional JavaScript code using point-free style and typeclasses. It includes code snippets demonstrating:
- Composing functions using point-free style to remove unnecessary variables
- Implementing common typeclass methods like map, chain, and ap for a Container type
- Deriving typeclass instances for custom types to gain functionality like Functor, Applicative, Foldable
- Using typeclasses to compose functions operating on different container types in a uniform way
The document provides code samples but does not explain concepts in detail. It focuses on demonstrating point-free code and typeclass patterns through examples rather than performing in-depth explanations or performance analysis. Questions are provided at the end to prompt
This document summarizes the history and future of PHP. It discusses the creators of PHP (Rasmus Lerdorf, Zeev Suraski, John Morris) and outlines the major versions released from PHP 1.0 in 1995 to the upcoming PHP 8.0, which will include features like FFI, JIT compilation, and asynchronous programming. It also previews potential features for future PHP versions such as OpCache core improvements and extending the instanceof operator.
Why would a manager be concerned with bandwidth How is bandwidth me.pdfFORTUNE2505
Why would a manager be concerned with bandwidth? How is bandwidth measured?
Solution
Bandwidth is defined as the network\'s capacity of transferring data and handling transmission.
In organisations, in order to run business efficiently, managers are determined to transfer and
receive information as quickly as possible without any delay or loss of valuable information.
Bandwidth enable managers to measure the network performance, that is, how efficient the
system is in sending and receiving data. Businesses, today, are majorly technology driven and
therefore, any delay in transmitting or accepting important information may deeply affect the
performance of the business. No manager would want poor bandwidth to have an impact on key
business variables or loss of business opportunities. They do not want any restriction on the flow
of data because of the slow transmission speed.
Bandwidth is measured in terms of bit rate performance, that is, the information sent or received
by bit per unit of time. Bandwidth is generally measured in the units of bps (bits per second),
kbps (kilobits per second), mbps (megabits per second), gbps (gigabits per second) and tbps
(terabits per second)..
Where would the Internet be today if the UNIX operating system did n.pdfFORTUNE2505
Where would the Internet be today if the UNIX operating system did not exist?
Solution
Answer:
The internet using today is actually runs through a linux server. Infact the internet is connected
with the linux servers and router with other linux servers all over. So if there would have been no
service of the UNIX , there would be no AIX , SOLARIS and LINUX. Now if there is no Linux ,
there is no android and the rest. I may say the scenerio would have been like a massive influence
software designs and offcourse there might be the chances that Nokia would have still ruling the
market. Cyber hackers would have been extinct. Window crashes would have been result in
increasing growth of sucides in the world :p.
More Related Content
Similar to Can you convert this code into a C++ code.pdf
This document describes a Javabean that allows displaying a Jslider component in an Oracle Forms application. The Javabean handles displaying the slider, setting properties like background color, and firing events when the slider value changes. It provides methods to initialize the slider, set properties like value, and get the current value. The sample Forms application demonstrates using the bean by initializing slider properties and handling value change events.
1. The document discusses various C++ concepts related to polymorphism and virtual functions including inheritance, upcasting, overriding virtual functions, pure virtual functions, virtual destructors, and operator overloading.
2. It provides code examples to demonstrate polymorphism with classes like Instrument, Wind, Pet and subclasses Dog and Cat.
3. It also shows examples of upcasting, downcasting using dynamic_cast, returning references/pointers to derived types, and ensuring proper object destruction with virtual destructors.
files/Heap.h
#ifndef HEAP_H
#define HEAP_H
#include <vector>
#include <stdexcept> // std::out_of_range
#include <math.h> // pow()
using namespace std;
template<typename T>
class Heap
{
private:
vector<T> _items; // Main vector of elements for heap storage
/**
* Used to take unsorted data and heapify it
*/
void buildHeap()
{
for (int i = _items.size() / 2; i >= 0; i--)
{
percolateDown(i);
}
}
/*********************************************************************/
/********************* Microassignment zone *************************/
/**
* Percolates the item specified at by index down
* into its proper location within a heap.
* Used for dequeue operations and array to heap conversions
* MA TODO: Implement percolateDown!
*/
void percolateDown(int index)
{
}
/**
* Percolate up from a given index to fix heap property
* Used in inserting new nodes into the heap
* MA TODO: Implement percolateUp
*/
void percolateUp( int current_position )
{
}
/************************** Microassigment zone DONE *********************/
public:
/**
* Default empty constructor
*/
Heap()
{
}
/**
* Constructor with a vector of elements
*/
Heap(const vector<T> &unsorted)
{
for (int i = 0; i < unsorted.size(); i++)
{
_items.push_back(unsorted[i]);
}
buildHeap();
}
/**
* Adds a new item to the heap
*/
void insert(T item)
{
int current_position = size(); // Get index location
_items.push_back(item); // Add data to end
percolateUp( current_position ); // Adjust up, as needed
}
/**
* Returns the top-most item in our heap without
* actually removing the item from the heap
*/
T& getFirst()
{
if( size() > 0 )
return _items[0];
else
throw std::out_of_range("No elements in Heap.");
}
/**
* Removes minimum value from heap and returns it to the caller
*/
T deleteMin()
{
int last_index = size() - 1; // Calc last item index
int root_index = 0; // Root index (for readability)
T min_item = _items[root_index]; // Keep item to return
_items[root_index] = _items[last_index]; // Move last item to root
_items.erase(_items.end() - 1); // Erase last element entry
percolateDown(0); // Fix heap property
return min_item;
}
/**
* Returns true if heap is empty, else false
*/
bool isEmpty() const
{
return _items.size() == 0;
}
/**
* Returns current quantity of elements in heap (N)
*/
int size() const
{
return _items.size();
}
/**
* Return heap data in order from the _items vector
*/
string to_s() const
{
string ret = "";
for(int i = 0; i < _items.size(); i++)
{
ret += to_string(_items[i]) + " ";
}
return ret;
}
/**
...
The document defines a class called ofBlob that represents a circle object that can be drawn and manipulated. It includes private variables to store the blob's position, dimension, speed, and phase. Methods are defined to initialize the blob, set/get its properties, update its position, and draw it. A testApp class is also defined that initializes a vector of ofBlob objects and calls their update and draw methods in a loop.
This document discusses various techniques for working with multimedia in Android applications, including detecting device capabilities, loading images from local storage and remote URLs, playing audio files from assets and raw resources, and improving performance through caching and asynchronous loading. It provides code examples for checking if a device has a front-facing camera, loading images while avoiding out of memory errors, playing audio files from assets, and using an AsyncTask to load images asynchronously to avoid blocking the UI. It also discusses potential memory leak issues and strategies for building an image cache.
The document discusses test-driven development (TDD) and how to test JavaScript code from a frontend perspective. It goes through the TDD cycle of writing a failing test first, then just enough code to pass the test, and refactoring. It provides examples testing user interaction, DOM manipulation, and mocking methods like Date and browser APIs. The goal is to write tests for all aspects of a date picker component, including showing/hiding on focus/click and adding a "selected" class. Tips provided include finding bugs to write tests for, pairing during TDD, using web APIs in tests, and not testing the browser itself.
This document provides instructions for using a web page to play YouTube videos in a random, continuous playlist. It includes:
1) Directions to download and view the web page files in a browser.
2) An explanation of the web page's functions like playing all videos, adding new videos, and saving an updated playlist.
3) An overview of the programming and JavaScript functions used to retrieve video data and play videos randomly.
The document discusses how the Kotlin compiler fakes or lies about certain Kotlin language features by decompiling the bytecode produced by the Kotlin compiler. It provides examples of how free functions, nested functions, primary constructors, extension methods, destructuring, object declarations, companion objects, enumerations, delegated properties, lambdas with receivers, and more are implemented under the hood by the compiler through bytecode tricks and deception. The document is intended to look under the hood of the Kotlin compiler and Java bytecode to understand how certain Kotlin features are implemented that don't have a direct mapping to Java.
Groovy is a dynamic language for the Java platform that provides features inspired by languages like Python, Ruby and Smalltalk. It allows Java developers to use these features with a syntax that is very similar to Java. Groovy code can be compiled to Java bytecode and integrated with Java applications and libraries. It supports features like closures, metaprogramming, builders and templates to improve developer productivity.
Talk given in French at ConFoo 2015
Le TDD (Test Driven Development) gagne en popularité dans la communauté PHP. C’est maintenant une pratique accepté. Mais commencer peut sembler difficile.
Dans cette session, nous allons voir ce qu’est le TDD. Nous allons commencer par voir les principes. Puis les outils utilisés, et comment s’en servir au quotidien. Nous allons aussi voir les difficultés souvent rencontrées et comment les contourner.
Davide Cerbo - Kotlin: forse è la volta buona - Codemotion Milan 2017 Codemotion
Dopo 20 anni Java inizia a sentire il peso degli anni e la sua sintassi non evolve come vorremmo, ma la JVM resta sempre un ambiente affidabile ed è già in produzione presso moltissime aziende. Negli ultimi anni sono usciti molti linguaggi basati sulla JVM, ma non tutti hanno avuto il successo sperato. Kotlin ha conquistato Android e, ora, grazie a una sintassi intuitiva e grandi aziende che lo supportano potrebbe essere molto utilizzato anche nelle applicazioni web. Durante il talk vedremo le basi del linguaggio e come sviluppare una applicazione web pronta ad andare in produzione.
Production.javapublic class Production { Declaring instance.pdfsooryasalini
The document defines classes for different types of productions - Production, Film, Play, and Musical. Production is the parent class that defines common properties like title, director, writer. Child classes like Film add properties specific to that type - box office gross for Film. The main method creates objects of each type and prints their details.
The document discusses various Kotlin language features and how they are compiled down to bytecode. It explains concepts like lowering, de-sugaring, and decompiling Kotlin programs. Specific language features summarized include free functions, nested functions, extension methods, data classes, object declarations, companion objects, and lambdas with receivers. The document shows how each feature compiles by decompiling example Kotlin code.
This program was designed by Cheriqua Tate to help an engineering company track customers and contractors for pool and hot tub projects. It contains panels to calculate pool and hot tub volumes, convert temperatures and lengths, and add/view customer and contractor information stored in text files. The main class initializes a tabbed pane interface containing panels for these different functions.
Just Click on Below Link to Download This Course:
https://www.devrycoursehelp.com/product/devry-gsp-115-all-assignments-latest/
DeVry GSP 115 All Assignments latest
DeVry GSP 115 Week 1 Assignment latest
Week 1: Simple Data Types
Instructions
Complete the following assignments. Cut and paste your finished code into a Word document, clearly identifying which assignment it is. Also, capture the output of the program and paste that into the Word document. If there are questions to be answered, put the answers after the output. When you complete all three of this week’s assignments, save the document as yourLastName_GSP115_W1_Assignments.docx. Submit it to the Week 1 assignment Dropbox.
Vaadin 7 is an open source web application framework that allows developers to build rich client-side web applications using Java on the server-side and JavaScript on the client-side, with new features in Vaadin 7 including improved component architecture, support for SASS styling, and enhanced widget communication through state-based RPC.
This document provides examples of functional JavaScript code using point-free style and typeclasses. It includes code snippets demonstrating:
- Composing functions using point-free style to remove unnecessary variables
- Implementing common typeclass methods like map, chain, and ap for a Container type
- Deriving typeclass instances for custom types to gain functionality like Functor, Applicative, Foldable
- Using typeclasses to compose functions operating on different container types in a uniform way
The document provides code samples but does not explain concepts in detail. It focuses on demonstrating point-free code and typeclass patterns through examples rather than performing in-depth explanations or performance analysis. Questions are provided at the end to prompt
This document summarizes the history and future of PHP. It discusses the creators of PHP (Rasmus Lerdorf, Zeev Suraski, John Morris) and outlines the major versions released from PHP 1.0 in 1995 to the upcoming PHP 8.0, which will include features like FFI, JIT compilation, and asynchronous programming. It also previews potential features for future PHP versions such as OpCache core improvements and extending the instanceof operator.
Similar to Can you convert this code into a C++ code.pdf (20)
Why would a manager be concerned with bandwidth How is bandwidth me.pdfFORTUNE2505
Why would a manager be concerned with bandwidth? How is bandwidth measured?
Solution
Bandwidth is defined as the network\'s capacity of transferring data and handling transmission.
In organisations, in order to run business efficiently, managers are determined to transfer and
receive information as quickly as possible without any delay or loss of valuable information.
Bandwidth enable managers to measure the network performance, that is, how efficient the
system is in sending and receiving data. Businesses, today, are majorly technology driven and
therefore, any delay in transmitting or accepting important information may deeply affect the
performance of the business. No manager would want poor bandwidth to have an impact on key
business variables or loss of business opportunities. They do not want any restriction on the flow
of data because of the slow transmission speed.
Bandwidth is measured in terms of bit rate performance, that is, the information sent or received
by bit per unit of time. Bandwidth is generally measured in the units of bps (bits per second),
kbps (kilobits per second), mbps (megabits per second), gbps (gigabits per second) and tbps
(terabits per second)..
Where would the Internet be today if the UNIX operating system did n.pdfFORTUNE2505
Where would the Internet be today if the UNIX operating system did not exist?
Solution
Answer:
The internet using today is actually runs through a linux server. Infact the internet is connected
with the linux servers and router with other linux servers all over. So if there would have been no
service of the UNIX , there would be no AIX , SOLARIS and LINUX. Now if there is no Linux ,
there is no android and the rest. I may say the scenerio would have been like a massive influence
software designs and offcourse there might be the chances that Nokia would have still ruling the
market. Cyber hackers would have been extinct. Window crashes would have been result in
increasing growth of sucides in the world :p.
What do you understand by degrees of Data AbstractionSolution.pdfFORTUNE2505
What do you understand by degrees of Data Abstraction?
Solution
While designing database we should start with abstract view of data environment and insert
details as implementation comes closer.Degress of data abstraction will help in implementing
different view of data.
There 4 Levels of degrees of Data Abstraction:
A}The External Model :It is available for end user.End user means people who use database
application and modify data.
B)The Conceptual Model:It considers all views of database and creates global view of
database.It is represented using ER diagram.
C)The Internal Model:It is formed after selection of database platform.It maps Conceptual Model
to DBMS.It represents databse as seen by DBMS.It will to acheive logical independence. logical
independence means changing internal model without affecting Conceptual Model.
D)The Physical Model This is last and lowest layer of abstraction.It represents how data is stored
in data disk or tapes.It depends on software and hardware.It allows to change Physical Model
without affecting Internal Model.It is called physical independence..
validity. (The Case lulTTtuT 2. Discuss the Economics of Effective Ma.pdfFORTUNE2505
validity. (The Case lulTTtuT 2. Discuss the Economics of Effective Management. List and
discuss the first 4 items. L4- page
Solution
Effective management leads to use scare resources in a way so that the maximum economic
benefit could be achieved by the whole organization. It indicates the minimum waste and the
maximum returns.
Required items:
1) Setting goal: Effective management sets goal of the organization considering all probable
constraints.
2) Profit reorganization: The role of profit creates motivation; management creates possibilities
(like new expansions, lowering costs, etc) so that profit could be increased in a substantial
amount.
3) Incentives: Understanding of such is very important. Management wants to create more
market for more incentives.
4) Markets: Understanding the true market (like middle-class customers, lower middle-class
customers, etc) for which products to be sold is an important act of effective management.
Creating opportunities in the market is the key to success..
Twitter had their IPO in 2013. Which of the following is not accurate.pdfFORTUNE2505
Twitter had their IPO in 2013. Which of the following is not accurate The lockup refers to a
portion of the IPO shares that cannot be sold in secondary market until months after the IPO date
Twitter\'s IPO share price is set before shares of Twitter open for trading on secondary markets
The amount of money that Twitter received from the IPO is determined by the number of IPO
day O shares and the market price of those shares when Twitter shares closed for trading on the
IPO Buyers of Twitter\'s stock become partial owners of the company.
Solution
Answer is A. THE reason is it is not ipo in true sense. Ipo is open to everyone not only few
shareholders. Here owners etc are prohibited to sell so it is not portion of ipo.
Use C programmingMake sure everything works only upload.pdfFORTUNE2505
Use C programming
Make sure everything works only upload
Solution
#include
float my_func(float x)
{
return (0.1*x*x*x)+1;
}
float approx_integral(float a, float b, int n)
{
int i;
float s=0,y=0,h;
h=(b-a)/n;
for(i=1;i<=n-1;i++)
{
s=s+my_func(a+i*h);
}
y=(my_func(a)+my_func(b)+2*s)*h/2;
return y;
}
int main()
{
float a,b;
int n;
printf(\"Integrate over [A,B] over N intervals. Input A, B, N: \ \");
scanf(\"%f %f %d\",&a,&b,&n);
if(b.
The Adventures of Huckleberry Finn was published twenty years after .pdfFORTUNE2505
The Adventures of Huckleberry Finn was published twenty years after the Civil
War and ten years after Reconstruction. However, it takes place 1834 (or perhaps
1844, according to Huck). In what ways does Huck function as a metaphor for the
adolescent America?
Solution
There is the nostalgic belief that America was built by a rugged individualism and people that
took the
\"road less travelled\" to forge their own future. Huck , for sure showcases this mythos. He goes
against \"civilized\"
Southern culture that, at that time, included institutionalized slavery and bondage. Huck made
his way down the Mississippi River
with an escaped slave. Huck developed his own social and moral code that often went against
Southern society.
He set a great examople for the adloscent America as he gave them hope that one needs to be
tough as when the going gets tough , the tough gets going. One is the master of ones own fate.
Step 1 You work for Thunderduck Custom Tables Inc. This is the first.pdfFORTUNE2505
Step 1 You work for Thunderduck Custom Tables Inc. This is the first month of operations. The
company designs and manufactures specialty tables. Each table is specially customized for the
customer. This month, you have been asked to develop and manufacture two new tables for
customers. You will design and build the tables. This is a no nail, no screw, and no glue
manufacturing ( no indirect materials used). You will be keeping track of the costs incurred to
manufacture the tables using Job #1 Cost Sheet and Job #2 Cost Sheet. The cost of the direct
materials that can be used to manufacture the table are as follows. These cost are on a per unit
basis. Table Top $1,500.00 Table Leg $400.00 Drawer $350.00 The company uses a job order
costing system and applies manufacturing overhead to jobs based on direct labor hours. The
company estimates that there will be 12 direct labor hours worked during the month. The
estimated manufacturing overhead cost for the month is: a. Factory supervisor salary per month
$2,500.00 b. Rent for the factory per month $1,100.00 c. Depreciation of factory equipment per
month $600.00 Total Estimated manufacturing overhead $4,200.00 What is the predetermined
manufacturing overhead rate? Step 2 The first order you received was to manufacture a table
using a table top and four legs. This is your Job #1. Step 3 The customer that has ordered Job #2,
wants a table that is the same as Job #1, but wants to also add a drawer to the table. Step 4 The
following is a list of transactions that need to be recorded for the company for activity in the
month of December. Record those in the \"General Journal\" tab of the excel file using the proper
format. Please use the following accounts: Accounts Receivables, Raw materials, Work in
process, Finished goods, Accumulated depreciation, Accounts payable, Salaries and wages
payable, Sales revenue, Manufacturing overhead, Cost of goods sold, Salaries and wages
expense, Advertising expenses, and Depreciation expense. 1-Dec Raw Materials purchased on
account, $15,000. 5-Dec All Raw Materials needed for Job #1 were requisitioned from the
material storage for use during the month. Assume all materials are direct. (After you journalize
this entry please enter the information into Job #1 Cost Sheet) 10-Dec The following employee
costs were incurred but not paid during the month: There are three assembly employees that
spend 2 hours each, $25 per hour to make the table for Job #1. (After you journalize this entry
please enter the information into Job #1 Cost Sheet) Salary for supervisor of the factory $3,000.
Administrative Salary $2,000. 15-Dec All Raw Materials needed for Job #2 were requisitioned
from the material storage for use during the month. Assume all materials are direct. (After you
journalize this entry please enter the information into Job #2 Cost Sheet) 16-Dec Rent for the
month of December for the factory building incurred but not paid $1,100. 17-Dec Advertising
costs incurred but n.
Researchers argue about whether Oldowan toolmakers were hunters or s.pdfFORTUNE2505
Researchers argue about whether Oldowan toolmakers were hunters or scavengers. What are the
main arguments on each side of this debate?
Solution
Oldowan tools were made by late Australopithecus and early Homo. Homo habilis was named
\"skillful\" because it was considered the earliest tool-using human ancestor. There are theories
which show that they could be hunters or scavengers. The association of oldowan tools suggest
their profession as hunters. There are also some theories suggesting they move carcasses from
dangerous death sites showing they were scavengers..
In Aristotles Poetics he speaks of epics and tragedies. How do.pdfFORTUNE2505
In Aristotle\'s \"Poetics\" he speaks of epics and tragedies. How do these apply in the story of
Gilgamesh?
Solution
In the Poetics, Aristotle among many epic moments describes three important parts of the Greek
tragedy
and in turn famous art.
The first being \"recognition\" which implies the realization of some truth, that often times
(initially) appears to
the hero as a form of ignorance.
The second part of the tragedy is \"reversal\" where by some form of journey,
the hero finds that recognition is kept in a kind of 180 degree turn where formerly held truths
are in reality versions of ignorance or that former versions of ignorance turn out to be visions for
the future.
The third part of epic tragedy is the \"tragic flaw.\" This term is a bit difficult to catch. In most
cases,
it implies that one\'s true character, the nature of one\'s soul or daemon or \"divine spirit.\" It is
not
about being evil. It refers to unforeseen events that arrive in mass when a hero fails to
follow his true character or when one\'s character causes a mistake in judgment.
the second part of the tragedy has some resemblense in the story of Gilgamesh
The Epic of Gilgamesh shows us the reality of recognition and reversal--for example,
the gardener is transformed into a mole. And more importantly we see our relation with nature
depicted as a reversal, when Enkidu is transformed from a wild beast into a domesticated man
, who knows the trappings of civilization and culture.
Name the type of chemical messenger is released from the axon termina.pdfFORTUNE2505
Name the type of chemical messenger is released from the axon terminal of a neuron and
directly communicates with other cells? Which type of chemical messenger, when released,
binds to receptors on the same cell that released the chemical messenger? Lipophilic chemical
messengers can cross the plasma membrane, true/false? Name 2 physiological processes (cell
responses) that are regulated by cell signaling. \'Receptor-ligand binding is specific\' What does
this phrase mean?
Solution
Please find the answers below:
Part 1: Neurotransmitter (any chemical or bio-molecule released from the neuron terminal which
transmite information from one neuron to another and help in communication)
Part 2: Autocrine chemicals (Autocrine chemicals and transmitters are those biomolecules which
are secreted by the cells and receptors for this ligand are present on the same cell. This
chemical/ligand is then internalized by teh same cell. Examples include TNF alpha, interleukins
etc.)
Part 3: True (The plasma membrane is a lipid bilayer by structure. Thus, only lipophilic
substances can pass through the membrane easily without being repulsed by it)
Part 4: Following intracellular signalling cascades and physiological processes are performed by
cell signalling:
Part 5: Receptor-ligand binding is specific in nature by the manner that every receptor has a
specific ligand which binds onto it. This ligand is structurally compatible to its receptor in the
same manner as the substrate is specific for the enzyme. Thus, only a ligand can bind to its
receptor and activate the intracellular signalling..
Marilee Jones, the former dean of admissions of the Massachusetts In.pdfFORTUNE2505
Marilee Jones, the former dean of admissions of the Massachusetts Institute of Technology
(MIT), resigned after twenty-eight years as an administrator in the admissions office. The dean
for undergraduate education received in- formation questioning Ms. Jones’s academic
credentials. Her résumé, used when she was hired by MIT, indicated that she had degrees from
Albany Medical College, Union College, and Rensselaer Polytechnic Institute. In fact, she had
no degrees from any of these schools or from anywhere else. She had attended Rensselaer
Polytechnic as a part-time non-matriculated student during the 1974–75 school year, but the
other institutions had no record of any attendance at their schools.
When Ms. Jones arrived at MIT for her entry-level position in 1979, a degree was probably not
required. However, she did progress through the ranks of the admissions of- fice, and, in 1997,
she was appointed dean of admissions. She explained that she wanted to disclose her lack of
degrees at that point but that she had gone on for so long that she did not know how to come
clean with the truth. Point to the initial decision, why it was flawed, why Ms. Jones made that
decision, and what had to be done after that as a result of that choice. Is there a rationale for
allowing Marilee Jones for retaining her position after this discovery.
Are there resume \"misstatements\" that should not lead to termination? What would these be?
Solution
Answer:
After realisnig that she is at guilt it is better for her to quit her position and continue to work as a
teacher which is a noble profession. Taking the responsibility for her mis statements is one of the
way to make amends in the wrongs that was not committed knowingly..
Know how the complement of mRNAs in a cell can be assayed (in plants.pdfFORTUNE2505
Know how the complement of mRNAs in a cell can be assayed (in plants)
Solution
Messenger RNA (mRNA) maturation in eukaryotic cells requires the formation of the 3 end,
which includes two tightly coupled steps: the committing cleavage reaction that requires both
correct cis-element signals and cleavage complex formation, and the polyadenylation step that
adds a polyadenosine [poly(A)] tract to the newly generated 3 end. An in vitro biochemical assay
plays a critical role in studying this process. The lack of such an assay system in plants hampered
the study of plant mRNA 3-end formation for the last two decades.
Gene expression in eukaryotes requires the transcription of DNA into mRNA in the nucleus. The
newly transcribed pre-mRNAs undergo extensive processing, such as 5-end capping and removal
of introns and 3-end polyadenylation before they are ready to be transported to the cytoplasm for
translation. Among pre-mRNA processing events, 3-end formation and polyadenylation are
known to regulate transcription termination, affect intron splicing, promote mRNA transportation
and translation initiation, and protect mature mRNAs from unregulated degradation. In addition,
alternative polyadenylation show that more than half of plant and mammal genes can be
alternatively processed at different locations, resulting in distinct mature mRNAs from the same
pre-mRNA transcripts . Due to its tight connections to transcription, translation, and RNA decay,
mRNA 3-end polyadenylation appears to act as a hub for fine tuning gene expression and
forming a regulation network.
The 3-end processing of mRNA includes two coupled steps: cleavage at a specific site at the 3-
UTR and an addition of a polyadenosine [poly(A)] tract to the newly formed 3 end. The
biochemical process of polyadenylation is relatively well studied in mammals and yeast
(Saccharomyces cerevisiae). The 3-end cleavage and polyadenylation reaction is guided by
sequence elements (cis-elements) in pre-mRNA, which are recognized by a protein complex that
carries out enzymatic cleavage and polyadenylation reaction at a specific site. This apparently
simple process directly involves several cis-elements, as well as more than 14 protein factors in
mammals. These 14 protein factors can be divided into several sub complexes, such as cleavage
and polyadenylation specificity factor (CPSF), cleavage stimulation factor, cleavage factor I, and
cleavage factor II. Meanwhile, poly(A) polymerase (PAP), poly(A) binding protein-II,
symplekin, and C-terminal domain of the RNA polymerase II have also been found to be
necessary in this 3-end processing complex . In yeast, a similar set of proteins, albeit named
differently, were also identified to be important for 3-end processing . The involvement of over
80 proteins that form a complex with functional poly(A) signals . The functionality of this larger
collection of associated proteins in polyadenylation, however, remains to be confirmed.
The mechanisms of mRNA 3-end .
In Module 5 the you are here slide indicates we are currently in.pdfFORTUNE2505
In Module 5 the \"you are here\" slide indicates we are currently in: Select one: Installing
vSphere Components Course introduction VMware vCenter Server Configuring and Managing
Virtual Networks
Solution
D. Configuring and managing Virtual networks.
Course introduction is starting module. and vmware and vsphere modules are already crossed..
Identify the role you believe mobile devices have on email investiga.pdfFORTUNE2505
Identify the role you believe mobile devices have on email investigations. Discuss and provide
an example of the added challenges that have been introduced based on the proliferation of
mobile device technologies and more organizations embracing BYOD solutions and
implementations.
Solution
Lost and taken mobile devices
Lost or taken knowledge
Lack of compliance with security rules
Document leak
Unmanaged devices
Device management on work networks.
I need to implement in c++ this non-List member function void print.pdfFORTUNE2505
I need to implement in c++ this non-List member function: void printList(List& theList, bool
forward) is a non-member function that prints a list either forwards (by default -- from head to
tail) when forward is true, or backwards (from tail to head) when forward is false. You must use
your ListItr class to implement this function.
I attached my ListItr class I\'m not sure how to implement this method help. This is one of the
classes needed to implement a doubly linked list
Solution
#ifndef LISTITR_H
#define LISTITR_H
#include
#include \"stdafx.h\"
// This is the content of the .h file, which is where the declarations go
class ListNode{
public:
ListNode* previous;
int value;
ListNode* next;
ListNode();
};
class ListItr {
public:
ListNode* current;
ListItr(ListNode* theNode);
void Insert(int value) const;
bool isPastEnd() const;
bool isPastBeginning() const;
void moveForward() ;
void moveBackward() ;
int retrieve() const;
};
// This is the end of the header guard
#endif
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently, but
// are changed infrequently
//
#pragma once
#include \"targetver.h\"
#include
#include
#include
#include \"ListItr.h\"
// TODO: reference additional headers your program requires here
#include \"stdafx.h\"
/*
for this first you need a class named ListNode
*/
using namespace std;
ListNode::ListNode()
{
previous=NULL;
next=NULL;
}
ListItr:: ListItr(ListNode* theNode){
current = theNode;
}
bool ListItr:: isPastEnd() const{
if (current->next==NULL)
return true;
else
return false;
}
bool ListItr:: isPastBeginning() const{
if (current->previous==NULL)
return true;
else
return false;
}
void ListItr:: moveForward(){
if (!isPastEnd())
current=current->next;
//cout << current;
}
void ListItr:: moveBackward(){
if (!isPastBeginning())
current=current->previous;
//cout << current;
}
int ListItr:: retrieve() const{
return current->value;
}
void ListItr::Insert(int value) const{
ListNode* theNode;
theNode->value=value;
while(!isPastEnd())
{
moveForward();
}//loop ends when current-> next is null
current->next = theNode;//inserts value at the end of the list
theNode->previous=current;//defines previous pointer
theNode->next=NULL;//defines next pointer
}
//Startnode is the first node of the list
void printList(ListNode* Startnode, bool forward){
// if(forward==true){
// moveForward();
// }
// if(forward == false){
// moveBackward();
// }
//object of class ListItr
ListItr list(Startnode);
if(forward==true)
{
while(!list.isPastEnd())
{
cout<.
I have another assignment due for an advance java programming class .pdfFORTUNE2505
I have another assignment due for an advance java programming class that I do not understand
how to do. I don\'t know how to implement the comparable interface and sort the cards from
lowest to highest based on suit within rank. And I also dont understand how I am suppose to add
a static nested class that implements the comparator interface and then sort the cards lowest to
highest based on rank within a suit. Then I have to add the different buttons and I am not sure
which class that these buttons are to be placed in. The buttons I have to add are: Deal Button,
Fish Sort Button, Spades Sort Button, and a Reverse Toggle Button. The description for each
button is in the instructions below:
Program 4 – Sorting with nested classes and lambda expressions
This program is a bit different from our others. Just like the last program, you will start with the
project that is attached to this assignment. Remember to rename the project. You will lose points
if you do not. Also, remember that you need to submit an Eclipse project, not just Java files. You
will lose points there as well.
The main point of the exercise is to demonstrate your ability to use various types of nested
classes. Of course, sorting is important as well, but you don’t really need to do much more than
create the class that does the comparison. In general, I like giving you some latitude in how you
design and implement your projects. However, for this assignment, each piece is very specific as
to how I want you to implement things. There are a number of parts to this program. Make
certain you accomplish the two additions to the Card class early-on since much of the rest of
your program will depend on that work.
The requirements:
Properly named project, good code (avoid redundancy), nice UI, etc. (20 pts)
Implement the Comparable interface in the Card class. (15 pts)
Sort the cards lowest to highest based on suit within rank, e.g.
2 clubs
2 diamonds
2 hearts
2 spades
3 clubs
3 diamonds
etc.
Add a static nested class to the Card class that implements the Comparator interface. (15 pts)
Sort the cards lowest to highest based on rank within suit, e.g.
2 clubs
3 clubs
4 clubs
5 clubs
etc.
In the UI, add the following to your interface.
Deal Button (10 pts)
Implement the Deal action handler using an inner class (not local). You may want to pull some
of the code from the show method that is already there. Or better, put the common code into a
class and call it.
Fish Sort Button (15 pts)
Sort the code in a way that would be useful playing Go Fish. I.e. with all of the cards grouped
together. Implement the action handler using a lambda expression in the UI. The code in the
lambda expression should depend on the Card class for the actual sorting (i.e. the natural order).
It must not call any other method in the UI class.
Spades Sort Button (15 pts)
Order the cards in such a way that they would be useful playing Spades; i.e. with the cards sorted
by rank within suit and the suits in the order pro.
4. Real gross domestic prodact A. measures the value of fimal goods a.pdfFORTUNE2505
4. Real gross domestic prodact A. measures the value of fimal goods and services produced
within the borders of a given country during a glven time period adjusted for inflation B. is a
measure of the overall level of prices mcasures the value of fieal goods and services produced
within the borders of a g during a given time peried using current prices C C measures the value
of final goods and services D, can change froem oene year to the next even if there is no change
in output 5.Which is the largest component the United States: of total expenditures in A. Net
Exports B. Consumption C. Govenment Purchases D. Investment 6 Fiscal policy refers to the: A.
manipulation of government spending and taxes to stabilize domestic output, employment and
the peice level. B. manipulation of the money supply to stabilize domestic output, employment,
and the price level. 7. In the United States, the money supply (Mi) is coemprised of: currescy,
checkable deposits, and near monies (saving deposits) B. coins, paper currency, checkable
deposits, and crodit balances with brokers. C. paper currency, coims, gold certificates, and time
deposits D. colns, paper currency, and checkable deposits. 8. Carrency in people\'s pockets and
purses are: A.?nchaled in M. but not in M, B. incladed in both fi and in Mi C. included in M6,bt
not in M D. excluded from Mi and A6 because people can exchange them for Federal Reserve
notes. 9. Currency held in commercial banks as reserves: A. not part of the nation\'s money
supply B. included in Af, but not in Ma C included both in Mi and in Ma D. included in Ma, but
not in M 10. Which definition(s) of the money supply consists of the most highly liquid assets
(can quickly be converted into cash)? A. MI B, M2 C. Neither or M2 D. MI and 2 11. The value
of money in the United States is based on the stock of gold and silver beld by the United Stanes
government. In other words, U.S. dollar is backed up by gold/silver A. True B, False Form A-
Page 12
Solution
4. The correct answer is A.
5. The correct answer is B.
6. The correct answer is A.
7. The correct answer is D.
8. The correct answer is B.
9. The correct answer is D.
10.The correct answer is A.
11. The correct answer is A..
Hypothesis What is your hypothesis for the genetic characteristi.pdfFORTUNE2505
Hypothesis What is your hypothesis for the genetic characteristics (e.g. dominant/recessive,
autosomal/sex-linked, etc.) of the traits you have chosen to study? What observations lead you to
make this hypothesis? What phenotypes and phenotypic ratio would you predict for the offspring
(the first generation, or F1 generation) of this cross? What genotypes and genotypic ratio would
you predict? How did you come to this prediction? Write your explanation as a hypothesis to the
experiment you are doing. Enter your answers here.
Solution
Hypothesis: A cross between pure breeding dominant and recessive genotypes obtain all
dominant phenotypes in the F1 generation.
Presence of criss cross inheritance confirms the sex linkage of the trait while same proportion of
affected son and daughter is the indicator of autosomal inheritance.
Dominant trait is expressed in both homozygous and heterozygous genotype while the recessive
trait is expressed in homozygous genotype only. Sex linked traits exhibit criss cross inheritance
(father to daughter and mother to son).
The cross( for dominant/recesive)= TT x tt= Tt
Phenotype- all tall
Genotype= all Heterozygous (Tt)
The cross (for autosomal/sex linked)= XcY (affected father) x XX (normal mother)= XcX
(normal but carrier daughters): XY (normal sons)..
How is a process shown in a DFD(data flow diagramSolution Data.pdfFORTUNE2505
How is a process shown in a DFD(data flow diagram?
Solution
Data Flow Diagram provides a visual representation of the flow of information within a system.
With sketching a Data Flow Diagram, you can notify the information provided by and delivered
to someone who takes part in system processes, the information required in order to complete the
processes and the information needed to be stored and accessed. A context diagram is a data flow
diagram that only illustrates the top level, or else known as Level 0. At this level, there is only
one able to be seen process node that represents the functions of a complete system in regards to
how it interacts with external entities. DFD is non-deterministic - The numbering does not
necessarily indicate sequence, it\'s useful in identifying the processes when discussing with
users. Process labels should be verb phrases; data stores are represented by nouns. A data store
must be associated to at least a process. An external entity must be associated to at least a
process. Data stores should not be connected to an external entity, otherwise, it would mean that
you\'re giving an external entity direct access to your data files. Data flows should not exist
between 2 external entities without going through a process.
Strategies for Effective Upskilling is a presentation by Chinwendu Peace in a Your Skill Boost Masterclass organisation by the Excellence Foundation for South Sudan on 08th and 09th June 2024 from 1 PM to 3 PM on each day.
A Strategic Approach: GenAI in EducationPeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Assessment and Planning in Educational technology.pptxKavitha Krishnan
In an education system, it is understood that assessment is only for the students, but on the other hand, the Assessment of teachers is also an important aspect of the education system that ensures teachers are providing high-quality instruction to students. The assessment process can be used to provide feedback and support for professional development, to inform decisions about teacher retention or promotion, or to evaluate teacher effectiveness for accountability purposes.
How to Fix the Import Error in the Odoo 17Celine George
An import error occurs when a program fails to import a module or library, disrupting its execution. In languages like Python, this issue arises when the specified module cannot be found or accessed, hindering the program's functionality. Resolving import errors is crucial for maintaining smooth software operation and uninterrupted development processes.
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...PECB
Denis is a dynamic and results-driven Chief Information Officer (CIO) with a distinguished career spanning information systems analysis and technical project management. With a proven track record of spearheading the design and delivery of cutting-edge Information Management solutions, he has consistently elevated business operations, streamlined reporting functions, and maximized process efficiency.
Certified as an ISO/IEC 27001: Information Security Management Systems (ISMS) Lead Implementer, Data Protection Officer, and Cyber Risks Analyst, Denis brings a heightened focus on data security, privacy, and cyber resilience to every endeavor.
His expertise extends across a diverse spectrum of reporting, database, and web development applications, underpinned by an exceptional grasp of data storage and virtualization technologies. His proficiency in application testing, database administration, and data cleansing ensures seamless execution of complex projects.
What sets Denis apart is his comprehensive understanding of Business and Systems Analysis technologies, honed through involvement in all phases of the Software Development Lifecycle (SDLC). From meticulous requirements gathering to precise analysis, innovative design, rigorous development, thorough testing, and successful implementation, he has consistently delivered exceptional results.
Throughout his career, he has taken on multifaceted roles, from leading technical project management teams to owning solutions that drive operational excellence. His conscientious and proactive approach is unwavering, whether he is working independently or collaboratively within a team. His ability to connect with colleagues on a personal level underscores his commitment to fostering a harmonious and productive workplace environment.
Date: May 29, 2024
Tags: Information Security, ISO/IEC 27001, ISO/IEC 42001, Artificial Intelligence, GDPR
-------------------------------------------------------------------------------
Find out more about ISO training and certification services
Training: ISO/IEC 27001 Information Security Management System - EN | PECB
ISO/IEC 42001 Artificial Intelligence Management System - EN | PECB
General Data Protection Regulation (GDPR) - Training Courses - EN | PECB
Webinars: https://pecb.com/webinars
Article: https://pecb.com/article
-------------------------------------------------------------------------------
For more information about PECB:
Website: https://pecb.com/
LinkedIn: https://www.linkedin.com/company/pecb/
Facebook: https://www.facebook.com/PECBInternational/
Slideshare: http://www.slideshare.net/PECBCERTIFICATION
This slide is special for master students (MIBS & MIFB) in UUM. Also useful for readers who are interested in the topic of contemporary Islamic banking.
Physiology and chemistry of skin and pigmentation, hairs, scalp, lips and nail, Cleansing cream, Lotions, Face powders, Face packs, Lipsticks, Bath products, soaps and baby product,
Preparation and standardization of the following : Tonic, Bleaches, Dentifrices and Mouth washes & Tooth Pastes, Cosmetics for Nails.
How to Build a Module in Odoo 17 Using the Scaffold MethodCeline George
Odoo provides an option for creating a module by using a single line command. By using this command the user can make a whole structure of a module. It is very easy for a beginner to make a module. There is no need to make each file manually. This slide will show how to create a module using the scaffold method.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
A review of the growth of the Israel Genealogy Research Association Database Collection for the last 12 months. Our collection is now passed the 3 million mark and still growing. See which archives have contributed the most. See the different types of records we have, and which years have had records added. You can also see what we have for the future.
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* ¤t) const;
};
#endif
dvdListTypeImp.cpp
#include
#include
#include "dvdListType.h"
using namespace std;
void dvdListType::searchDVDList(string title, bool& found,
nodeType* ¤t) 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
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,
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