Implementing a set class of data

Assignment Help Basic Computer Science
Reference no: EM13829590

Problem:

Implement the following Set class. A set is a collection of items with no duplicates. The following class implements a set of integers.

#ifndef SET_H 
#define SET_H 
#include <iostream> 
#include <vector> 
using namespace std; 
class Set 

// friend operator functions 
friend ostream &operator<<(ostream & out, const Set & s); 
friend istream &operator>>(istream & in, Set & s); 
public: 
// Constructors 
Set(); // default constructor 
Set(const Set & s); // copy constructor 
// destructor 
~Set(); 
// operator functions 
Set operator||(Set & s); // union of the set with the set s 
Set operator&&(Set & s); // intersection of the set with the set s 
const Set& operator=(const Set & s); // assignment 
bool operator==(const Set & s); // equality 
int& operator[](int index); // returns modifiable lvalue 
int operator[](int index) const; // returns rvalue 
// Set membership functions 
bool member(int m); // The integer m is a member 
void add(int m); // add the integer m to the set 
void remove(int m); // remove the integer m from the set 
private: 
vector<int> _s; 
}; 
#endif

The member functions must be written in a file Set.cpp. You are required to provide a driver program for the above class as well.

Additional Information:

This question is from Computer Science as well as it discusses about implementing a set class of data with no duplicates using C++. Apart from this, a driver program for the class.

Reference no: EM13829590

Questions Cloud

Bonds make annual payments-what is the current bond price : Bey Co. issued 20-year, $1,000 bonds at a coupon rate of 7 percent. The bonds make annual payments. If the YTM on these bonds is 5 percent, what is the current bond price?
Discuss the importance of securing advance directives : As a health administrator, discuss the importance of securing advance directives at the time of inpatient registration or emergency care. As a health administrator, discuss how advance directives would have facilitated care in the Quinlan and Shiavo ..
Describe strategy to identify the best and worst selling : Given the sales data shown on accompanying worksheet, describe a strategy to identify the best and worst selling days during the period (i.e., Monday through Sunday), the average sales by day, and to sort total monthly sales from lowest to highest.
Discuss the importance of securing advance directives : As a health administrator, discuss the importance of securing advance directives at the time of inpatient registration or emergency care. As a health administrator, discuss how advance directives would have facilitated care in the Quinlan and Shiavo ..
Implementing a set class of data : The member functions must be written in a file Set.cpp. You are required to provide a driver program for the above class as well.
Increased the importance of personal financial planning : There are at least three major areas that affect financial decisions. Life situations such as income, age, household size, and health. What are some of the social and economic factors that have increased the importance of personal financial planning ..
Process of preparing annual budget : Arter Corporation is in the process of preparing its annual budget. The following beginning and ending inventory levels are planned for the year. How much of the raw material should the company purchase during the year? Assume that company plans to s..
Officers refuse direct orders that violate human rights : 1.1 you think that individuals in a war have personal accountability for their violations of fundamental human rights? 1.2 Can individual soldiers or intelligence officers refuse direct orders that violate human rights? Should soldiers be held person..
Estimating the values of the fields : Suppose that an Ethernet packet is given and its hexadecimal dump is shown as below, where the Ethernet preamble and the Ethernet checksum trailer have been removed. Manually decode this Ethernet packet, and determine the values of the fields.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Scrum vs plan-based software development strategies

Scrum vs. Plan-Based Software Development Strategies

  Discussion centers on e-commerce

Discussion centers on e-commerce, the use of web sites for the buying and selling of goods and services. For your discussion this week, first visit this link on how to make a terrible website. It's a tongue-in-cheek look at what not to do on yo..

  Data for applications built with modern technologies

1. Provide an example of a software component and another example of a software service. Explain what these examples have in common and how they differ. 2. Consider a legacy system and explain how services could be used to implement wrappers to provi..

  Department of management information systems

Identify the benefits of using e-learning from the perspective of students of the first level in the Department of Management information systems.

  How many pages are needed to store the entire job

How many pages are needed to store the entire job?

  Steps for company browse the site using this url

The static IP address of the server is 192.168.45.200. What steps do you take so that each computer in  company can browse site by using this URL?

  Expert systems created-deployed in real-world applications

Expert systems have been created and deployed in many real-world applications to support decision making. Discover one recent case study or academic journal article.

  Two or more areas must be interconnected

Two or more areas must be interconnected

  Convert number f(t) decaying each minute to the number r(t)

Radioactive carbon 11 has a decay rate k of 0.0338 per minute-that is, a particular C11 atom has a 3.38% chance of decaying in any one minute. Suppose we start with 100 such atoms.

  How could a business use information technology

How could a business use information technology to increase switching costs and lock in its customers and suppliers? Use business examples to support your answers

  Work with classes as reusable code

Objective: Work with classes as reusable code and random numbers. Instructions: A slot machine is a device that the user inserts money into and then pulls a lever (or presses a button).

  Write one function that reads the input using alias paramete

Write one function that reads the input using alias parameters (reference parameters).Write a second function that calculates the pay amount. If the salesperson owes money, thereturn amount from the function is a negative number.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd