Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

To demonstrate the ability to represent data, such as sets, using bit strings and to perform the appropriate logical operations on those representations to compute

To demonstrate the ability to represent data, such as sets, using bit strings and to perform the appropriate logical operations on those representations to compute the desired results. This program should be written in Java, C++, or C. Discussion: A bit string is a sequence of bits used to store or represent values. In this case, each bit represents a digit from 0 to 9. As a result, the bit position can be used as the value representation while the value represents whether that digit is a member of the set. For example, using a 16 bit integer to store our set, the binary representation of the set 10, 3, 5) would be: 00000000000101001 which would be the decimal integer value 41. Note bits 0.3 and 5 are all set to indicating set membership For this assignment you will write a program that reads elements of a two sets from the keyboard and display the results of operations on those sets Given subsets A and B of a universal set with 10 elements (0, 1, 2, 3, 4, 5, 6, 7, 8, 91.write a c. C++ or Java program that uses bit strings to find the results of set operations complement, union, intersection, difference, and symmetric difference. You should refer to this document for help Note: You must use integers to represent the sets. Things that are NOT integers: arrays of anything, strings, pre-defined library classes. You should declare one integer for the set A and


be tested with the following pairs of set data Set A - 0 1 2 3 4 5) Set B 3 4 5 6 7 8 9 Set A(3 4 5 3) Set B (1 2 3 4) Set A = {0 2 4 6 B) Set B = (1 3 5 7 9) Set A = [] Set B = (1 59) Input should be read from prompts on the keyboard (which can be provided through input redirection). The number of elements in the set should come first, followed by list of elements in that set. Repeated elements should not cause problems and elements outside the appropriate range should generate an error message. Here is a sample program for Windows, you must run it on the command line, bitstring.exe The input portion of your program should look like: CS 2130 - Computational Structures Wald Wildcat This program reads in the values of tweets and displays the results of several operations on the sets. Please enter the ruber of elements in set




enter element 21 2 Please enter elment ) Please enter the number of elements into The sets may contain anywhere from zero to ten elements. You need to ensure the values entered are between 0 and 9, but you should not test if a value has already been entered. Output results should be clearly displayed with appropriate labeling. An example of a typical output format is given here: Input Sets Set A 0,1,2) Set 12,3,4) Complement of A- (3,4,5,6,7,6,9) Union of A and B = 30,1,2,3,4) Intersection of Aand () Difference of ANS 8 - (0.1) Symmetric Difference of A and 1,2,3,4) Once you have completed your program and tested it with the sets above, submit your source code file for grading,





Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Principles of Auditing and Other Assurance Services

Authors: Ray Whittington, Kurt Pany

19th edition

978-0077804770, 78025613, 77804775, 978-0078025617

More Books

Students also viewed these Programming questions

Question

describe the key characteristics of a theoretical model in general;

Answered: 1 week ago