Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

here is the bits.txt text: P01: 10100001001010111000001111000000 P02: 11110011101010010110110010111011 P03: 10000101101010111101011101110111 P04: 10110011111111000111110110001111 P05: 10011011000101100001011100010100 P06: 00110010001100000101111111000010 P07: 10111110100111111000001000101000 P08: 00100101101000011001001100001000 P09: 11101000110000101110000111000001 P10: 00010101001101000001101000100000

image text in transcribedimage text in transcribed

here is the bits.txt text:

P01: 10100001001010111000001111000000 P02: 11110011101010010110110010111011 P03: 10000101101010111101011101110111 P04: 10110011111111000111110110001111 P05: 10011011000101100001011100010100 P06: 00110010001100000101111111000010 P07: 10111110100111111000001000101000 P08: 00100101101000011001001100001000 P09: 11101000110000101110000111000001 P10: 00010101001101000001101000100000 P11: 10000001000111000111100100010101 P12: 00010011011110000011111011011100 P13: 01000000011111001110011100010001 P14: 11101110110111110111101101011111 P15: 00101100011111001000100010101110 P16: 11010110011001000111111011111011 P17: 00001100101001000110111010100010 P18: 01010000010111101000000011010000 P19: 00101010110011011111111110111101 P20: 00100010011000000110011101101001

You are required to write a C++ program that would serve as a Bit Stuffing which is a mechanism of inserting one or more non-information bits into a message to be transmitted, to break up the message sequence, for synchronization purposes in computer networking. You are provided a text file (bits.txt) with this lab which contains the Packet number and sequence of bits for each packet. Ask the User to provide a sequence of O's and 1's, e.g., 1100 and search for it in the file. You are required to perform the following tasks: - Read the text file line by line - Create a Bits class with at least the following: - Private data members - string sequence - string packet - Corresponding Getters and Setters along with a Default Constructor - A method that would simply cout packet: sequence - A method that checks to see if any value of sequence or packet is empty and returns true if any of them is empty else returns false. This is an optional method and you are free to ignore it but can be helpful in not displaying the null values. - Create a ( ) method that creates a Bits object for the above class by searching whether a word read from a file contains the user entered bit sequence or not. If it does, it should set the sequence and packet for that particular object using setter methods and returns the object. - Every time a sequence entered by the user is found in the read file, you are required to create an array of Bits objects in the heap. It means that you are constantly increasing the size of the array in the heap on each search of the sequence. For this purpose, use a method that can resize the array in the heap that would return a Bits object pointer by taking in as a parameter, a Bits object pointer and address of size variable from the main method. The definition of this function should be Make sure to delete any space occupied programmatically when it's not required. - Create a function to display the report shown below in the expected output. - Finally, prompt to see if the user wants to start from the beginning and enter another sequence, expanding the array. - You can only use \#include, \#include, \#include libraries. Below is the expected output of the program: In the above example an array of size 9 will be created in the heap where each index contains an object of Bits class

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

MFDBS 91 3rd Symposium On Mathematical Fundamentals Of Database And Knowledge Base Systems Rostock Germany May 6 9 1991

Authors: Bernhard Thalheim ,Janos Demetrovics ,Hans-Detlef Gerhardt

1991st Edition

3540540091, 978-3540540090

More Books

Students also viewed these Databases questions

Question

How does a shell script evaluate conditional statements?

Answered: 1 week ago

Question

Relational Contexts in Organizations

Answered: 1 week ago