Here this is the concept of OOP’s
Category: C++
-
C++ Question
Background
For this deliverable, your team is expected to furnish the following components. All items must be diligently addressed unless prior arrangements have been mutually agreed upon. The work submitted must meet the standards of completeness, accuracy, persuasiveness, and professional presentation. Any deviations from these expectations should be communicated in advance for appropriate consideration. This ensures that the deliverable not only adheres to specified requirements but also reflects a high level of professionalism and competence.
Instructions
Design Concepts: (Section 3.2 & 3.3)
Software design is the crucial process of creating a comprehensive engineering representation or model for a planned software product. Designers face the challenge of building a diverse repertoire of alternative design information and selecting elements that align most effectively with the analysis model. This involves thoughtful consideration of various factors to ensure the resulting design model is a fitting response to the customer’s requirements.
Key Points:
- Quality Assessment of Design Model:
-
- The design model, stemming from the customer’s requirements, undergoes a rigorous assessment against predefined criteria to ensure quality.
- The evaluation process aims to identify and rectify errors, inconsistencies, or omissions. It also considers the existence of better alternatives and assesses whether the design model aligns with project constraints.
- Transformation of Software Requirements Model:
-
- Throughout the design process, the software requirements model, encompassing data, function, and behavior, is systematically transformed.
- Design models emerge, detailing the intricacies of data structures, system architecture, interfaces (User Interface is a component of deliverable #2), and the necessary components to actualize the envisioned system.
- Review for Quality Assurance:
-
- Each design product undergoes a thorough quality review before progressing to the subsequent phase of software development.
- The review process ensures that the design model is not only error-free but also aligns optimally with the project’s goals and constraints.
Create a set of Use Case (show actors, processes, system boundaries) and Data Flow Diagrams (DFD) for the system you are proposing. Be sure to include essential administrative functions in your diagram. Write a brief narrative for each Data Flow Diagram explaining the data flow. Indicate the entitys priority level (A, B, C – explained below), all preconditions, post-conditions, and triggers for the entities. Briefly describe all actors (users, systems, or organizations) who interact with your system, as indicated in your diagram. Do not assume that the meaning of any entity, actor, or function is obvious to your readers; your descriptions must be very clear and unambiguous.
Note: Each entity must be assigned a priority:
A – Essential for system operation.
B – Not essential for system operation but would add significant value to system’s users or stakeholders.
C – Would add some small, but real or perceived value to the system’s users or stakeholders.
Upload your Deliverable (One submission per team) in the digital dropbox. Make sure of the following before you upload the files.
- Use your name and Deliverable number as File Name. (e.g. Last Name of all team members_Deliverable_1).
- Add your name and assignment number at the top of first page for example: // Last Name of all team members Deliverable #1.
- Make sure you send the file in DOC. or DOCX format only.
- Handwritten/drawn and scanned files are not acceptable and will not be graded.
- Only electronic submissions via digital dropbox are acceptable.
-
How c# are important in the world of programing
C# can do somuch things such as reading codes,reading errors of your coding and c# telling proggramers how to do proggraming without any uneccesary codes
-
write a c++ program to find factorial of a number
1.take input number n
2. initializes fact =1
3.multiply number from 1 to n
-
apa pengertian echo Chamber
Pertanyaan ini berkaitan dengan lingkungan dan pola berpikir manusia dan keyakinan
-
C# Question
I want help with my programming assignment which contains 5 parts , I have completed part 1 and part 2 . You have to make sure you follow my coding style do encapsulation,etc.
-
C++ Question
make sure no ai is being used at all
This assignment will introduce you to interprocess synchronization mechanisms in UNIX using named POSIX semaphores, pthread mutex semaphores, and pthread condition variables.
Problem:
For this assignment, you will modify your solution for programming assignment 1 to comply with the restrictions explained below.
Your multithreaded decoder for a new compression algorithm created by Dr. Rincon must execute the following steps:
-
Read the symbols and the encoded message from STDIN (the Moodle server will implement input redirection to send the information from a file to STDIN).
-
Sort the alphabet symbols in descending order based on their frequency. If two or more symbols have the same frequency, sort them according to lexicographical order (ascending based on ASCII value).
-
Create n POSIX threads (where n is the number of unique symbols in the original message). The main thread must pass the encoded message, the symbol to decode, and the memory location to store the decoding results, ensuring that the first child thread prints the first symbol in the alphabet, the second child thread prints the second symbol in the alphabet, and the nth child thread prints the nth symbol in the alphabet.
-
Print the decoded message.
Each child thread executes the following tasks:
-
Receives the encoded message, the symbol to decode, and the memory location to store the decoding results.
-
Determines the positions of the assigned symbol in the original message.
-
Stores the assigned symbol, using the determined positions, into the memory address shared with the main thread that contains the decoded message.
-
Prints the information about the assigned symbol in descending order based on the symbols’ frequency (if two or more symbols have the same frequency, you will print the symbols based on their lexicographical order).
Input example:
4A 5C 2B 2D 310100010000010000001010001100011100010010010100010110110001100The expected output is:
Symbol: A, Frequency: 5Positions: 0 1 3 7 9Bits to represent the position(s): 23Symbol: D, Frequency: 3Positions: 5 6 8Bits to represent the position(s): 17Symbol: B, Frequency: 2Positions: 4 10Bits to represent the position(s): 12Symbol: C, Frequency: 2Positions: 2 11Bits to represent the position(s): 10Decoded message: AACABDDADABCNOTES:
-
You can safely assume that the input files will always be in the proper format.
-
You cannot use global variables. A 100% penalty will be applied to submissions using global variables.
-
You must define the critical sections following the guidelines discussed in class.
-
You must use POSIX threads. A penalty of 100% will be applied to submissions using a thread library other than the pthread library.
-
To achieve synchronization, you can only use named POSIX semaphores, pthreads mutex semaphores, or pthreads condition variables. You are not allowed to use pthread_join or sleep to synchronize your threads (you must use pthread_join to guarantee that the parent thread waits for all its child threads to end before ending its execution). Submissions using the previous system calls to synchronize the child threads will be penalized 100%.
-
You cannot use different memory addresses to pass the information from the parent to the child threads.
-
You must use the output statement format based on the example above. The child threads must print the encoded messages in the order in which they were created.
ASSIGNMENT RUBRIC:
- 15 points for each test case with a correct output (max 30 points).
- 25 points for using a single memory location for thread argument passing.
- 5 points for code readability (modularity + comments).
- 10 points for taking full advantage of multithreading.
- 30 points for solving the two synchronization problems correctly (correct usage of critical sections, semaphores, pthreads mutex semaphores, pthreads condition variables, pthread_join).
Penalties:
- 100% for using global variables.
- 100% for not using the pthread library.
- 100% for presenting a solution that does not compile.
Requested files
main.cpp
assignment 1 that it is refereeing to is below including the code I submitted
You need to develop the decoder for a new compression algorithm created by Dr. Rincon to evaluate the effectiveness of Elias-Gamma encoding for larger integer values. The proposed compression algorithm works as follows:
-
Determine the frequency of symbols in the message.
-
Sort the alphabet symbols in descending order based on their frequency. If two or more symbols have the same frequency, sort them according to lexicographical order (ascending based on ASCII value).
-
Create the encoded message by appending the positions of the symbols (based on the sorted alphabet) in the original message. Since Elias-Gamma encoding is used to represent the positions, the values for the positions start from one.
Given the following original message: AACABDDADABC
The alphabet is sorted as A, D, B, and C, and the positions in the encoded message are: 1, 2, 4, 8, 10, 6, 7, 9, 5, 11, 3, and 12 (represented as Elias-Gamma codes).
Your decoder takes the following information as input from the standard input (STDIN):
-
An integer representing the alphabet size (m).
-
m symbols. Each symbol is represented by a single character and an integer value indicating its frequency.
-
A binary string with positions encoded using Elias-Gamma code. The position values are stored according to the order of symbols in the sorted alphabet.
For this assignment, you will create a multithreaded program to find the positions of the symbols in the original message, reconstruct the original message (based on the encoded message), and determine the number of bits required to represent the positions using Elias-Gamma encoding.
Given the following input:
4A 5C 2B 2D 310100010000010000001010001100011100010010010100010110110001100The expected output is:
Symbol: A, Frequency: 5Positions: 0 1 3 7 9Bits to represent the position(s): 23Symbol: D, Frequency: 3Positions: 5 6 8Bits to represent the position(s): 17Symbol: B, Frequency: 2Positions: 4 10Bits to represent the position(s): 12Symbol: C, Frequency: 2Positions: 2 11Bits to represent the position(s): 10Decoded message: AACABDDADABCProcess:
Your solution must execute the following steps:
-
Read the input lines from STDIN.
-
-
Create m POSIX threads (where m is the alphabet size). Each child thread performs the following tasks:
-
– Receives the encoded message, the symbol to decode, and the memory location to store the decoding results.
– Determines the positions of the assigned symbol in the original message.
– Calculates the number of bits used to represent the symbol’s position using Elias Gamma encoding.
– Stores the assigned symbol’s information in a memory location accessible by the main thread.
– Stores the assigned symbol, using the determined positions, into the memory address shared with the main thread that contains the decoded message.
-
Print the information for each symbol to STDOUT (sorted according to the compression algorithm rules).
-
Print the decoded message.
Notes:
-
The position values for the symbols must start from one (not from zero), because Elias Gamma encoding can only represent positive integers starting from one.
-
You can safely assume that the input will always be in the proper format.
-
You must use the output statement format shown in the example above.
-
You can define additional functions if needed.
-
You must take full advantage of multithreading.
-
You must present code that is readable and has comments explaining the logic of your solution. A 10% penalty will be applied to submissions that do not follow this guideline.
-
You cannot use global variables. A 100% penalty will be applied to submissions using global variables.
-
Not using multiple POSIX threads (the pthread.h library) to implement your solution will result in a 100% penalty. DO NOT USE THE THREAD LIBRARY FROM C++.
-
A penalty of 100% will be applied to solutions that do not compile.
-
A penalty of 100% will be applied to solutions that hardcode the output.
Assignment rubric:
-
Correct output: 10 points per test case (20 points total).
-
Correct implementation of the thread function: 30 points.
-
Taking full advantage of multithreading (no pthread_join or sleep in the same loop as pthread_create): 30 points.
-
Creating the correct number of threads: 10 points.
-
Having clean and commented code: 10 points.
Penalties:
-
Presenting a solution that does not compile: -100 points.
-
Not using POSIX threads: -100 points.
-
Hardcoding the output: -100 points.
-
Using global variables: -100 points.
-
Using AI tools without following the rules stated in the syllabus: -100 points.
and the code below I got a 100 on #include <iostream>#include <vector>#include <string>#include <algorithm>#include <pthread.h>#include <sstream>using namespace std;//Structure used to store results for each symbolstruct SymbolResult { char symbol; int frequency; vector<int> positions; // posiitons start at 0 int bits_used;};// Data passed to each threadstruct ThreadData { char symbol; int frequency; int start_index; const vector<int>* decoded_positions; // decoded positions are counted started from 1 SymbolResult* result; string* decoded_message;};// Elias-Gamma decoder for one integerint decode_gamma(const string& bits, int& index, int& bits_consumed) { int zero_count = 0; //count the number of leading zeros while (index < (int)bits.size() && bits[index] == ‘0’) { zero_count++; index++; } //read the next zeros+1 bits int length = zero_count + 1; int value = 0; for (int i = 0; i < length; i++) { value = (value << 1) + (bits[index] – ‘0’); index++; } bits_consumed = zero_count + length; return value;}// Thread functionvoid* thread_function(void* arg) { ThreadData* data = static_cast<ThreadData*>(arg); data->result->symbol = data->symbol; data->result->frequency = data->frequency; data->result->bits_used = 0; for (int i = 0; i < data->frequency; i++) { int pos_1_based = (*(data->decoded_positions))[data->start_index + i]; int pos_0_based = pos_1_based – 1; data->result->positions.push_back(pos_0_based); // Write into shared decoded message (*(data->decoded_message))[pos_0_based] = data->symbol; // Calculate Elias-Gamma bit cost int temp = pos_1_based; int binary_length = 0; while (temp > 0) { binary_length++; temp >>= 1; } data->result->bits_used += (binary_length – 1) + binary_length; } pthread_exit(nullptr);}// Sorting rule: Descending frequency, ascending ASCIIbool compare_symbols(const SymbolResult& a, const SymbolResult& b) { if (a.frequency != b.frequency) return a.frequency > b.frequency; return a.symbol < b.symbol;}int main() { int m; string line; // Read m from its own line getline(cin, line); m = stoi(line); vector<SymbolResult> symbols(m); for (int i = 0; i < m; i++) { while (getline(cin, line)) { if (line.size() >= 3) break; } symbols[i].symbol = line[0]; // Frequency is the last whitespace-delimited token on the line // Find it by scanning from the end size_t end = line.find_last_not_of(” trn”); size_t start = line.find_last_of(” t”, end); symbols[i].frequency = stoi(line.substr(start + 1, end – start)); } sort(symbols.begin(), symbols.end(), compare_symbols); // Read the bit string string bit_string; cin >> bit_string; int total_positions = 0; for (const auto& s : symbols) total_positions += s.frequency; vector<int> decoded_positions(total_positions); int bit_index = 0; for (int i = 0; i < total_positions; i++) { int bits_used; decoded_positions[i] = decode_gamma(bit_string, bit_index, bits_used); } string decoded_message(total_positions, ‘ ‘); vector<pthread_t> threads(m); vector<ThreadData> thread_data(m); int start_index = 0; // Create all threads for (int i = 0; i < m; i++) { thread_data[i].symbol = symbols[i].symbol; thread_data[i].frequency = symbols[i].frequency; thread_data[i].start_index = start_index; thread_data[i].decoded_positions = &decoded_positions; thread_data[i].result = &symbols[i]; thread_data[i].decoded_message = &decoded_message; pthread_create(&threads[i], nullptr, thread_function, &thread_data[i]); start_index += symbols[i].frequency; } for (int i = 0; i < m; i++) pthread_join(threads[i], nullptr); // Output for (const auto& s : symbols) { cout << “Symbol: ” << s.symbol << “, Frequency: ” << s.frequency << endl; cout << “Positions: “; for (int pos : s.positions) cout << pos << ” “; cout << endl; cout << “Bits to represent the position(s): ” << s.bits_used << endl << endl; } cout << “Decoded message: ” << decoded_message << endl; return 0;}
-
-
Communication is a process of Sharing ideas, thoughts betwee…
Communication is a way to send or transfer data from one place to another place.
-
Make HTML Program of Flappy Bird Game and make presentation…
Using the Flappy bird game, make me a powerpoint that has everything included that I attached on the screenshot. Make sure the program is made using HTML and Quick code. Make sure the powerpoint includes short points and includes pictures or demonstrations from the program. Make sure that it has everything included in the screenshots.