C How to Program (8th Edition)
C How to Program (8th Edition)
8th Edition
ISBN: 9780133976892
Author: Paul J. Deitel, Harvey Deitel
Publisher: PEARSON
bartleby

Concept explainers

Question
Book Icon
Chapter 17, Problem 17.21E
Program Plan Intro

Program plan:

  • Define class IntegerSet. Inside this class,
    • Include a private data member setwhich is an array of size 100of type int.
    • Include a constructor to initialize above data member to zero.
    • Provide a function insertElement to addinteger element to the set.
    • Provide a function deleteElement to delete an element fromthe set.
    • Provide a function unionOfSets to find union of two integer sets.
    • Provide a function intersectionOfSets to find intersection of two integer sets.
    • Provide a function isEmpty to check if the set is empty.
    • Provide a function isEqualTo to check if two sets are equal.
    • Provide a function printSet to print the values in the set.
  • Define a main function. Inside main function,
    • Define four objects set1, set2, set3 and set4 of IntegerSet class.
    • Use all of IntegerSet class functions on these objects.

Program Description: The following program will create aIntegerSet class to represent the set of integers numbers and include functions for operations on two integer sets.

Blurred answer
Students have asked these similar questions
(Tic-Tac-Toe) Write a program that allows two players to play the tic-tac-toe game. Your program must contain the class ticTacToe to implement a ticTacToe object. Include a 3-by-3 two-dimensional array, as a private member variable, to create the board. If needed, include additional member variables. Some of the operations on a ticTacToe object are printing the current board, getting a move, checking if a move is valid, and determining the winner after each move. Add additional operations as needed.
Salesforce Assignment: You are working in company as a junior developer and the manger assign you a task to create the test class of trigger code of the following code will cover all the use case like insert, update, delete. The code is as follows: public class TriggerBasicAssignmentTriggerHelper ( // This method is used to update the vlaue of field C public static void getFiledvalue(List listofValues, Map mapofCoustomobject ){ for (Trigger_Basic_Assignments_ct :listofvalues){ if(mapofCoustomobject == null || t.Field_A_c != mapofCoustomobject.get(t.Id). Field_A_C || t.Field_8_c != mapofCoustomobject.get(t.I if(t.Operator_ '+') t.Field C_c = t.Field_A_c + t.Field_B_c; else if(t.Operator_c *') t. Field C_c = t.Field A_* t.Field_8_c; else if(t.Operator_c == /' && t.Field B_c != 0) t.Field C_c = t.Field A_c / t.Field_B_c; else t.Field C_c = t.Field_A_c - t.Field B_c; I need the test class only.
Question 2: (TicTacToe Class) Create a class TicTacToe that will enable you to write a complete program to play the game of tic-tac-toe. The class contains as private data a 3-by-3 two-dimensional array of integers. The constructor should initialize the empty board to all zeros. Allow two human players. Wherever the first player moves, place a 1 in the specified square. Place a 2 wherever the second player moves. Each move must be to an empty square. After each move, determine whether the game has been won or is a draw. If you feel ambitious, modify your program so that the computer makes the moves for one of the players. Also, allow the player to specify whether he or she wants to go first or second.
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education