Category: C++

  • Test Functions for Program Submission

    Instructions
    Download and extract the .zip file with program source code and directions.
    Complete the Test functions in the Submission.cpp file.
    While working, Debug/Run the lab to see how many test runs pass or fail.
    Ideally, you want all test runs to pass to get the maximum amount of points.
    Your grade is shown at the bottom when you run the program.
    You cannot use auto in place of known data types in PG1.
    You cannot use the t_size data in place of the integer data type when creating iterators in a for loop.
    You cannot use the null reference operator to terminate a for loop.
    You cannot use multiple return statements in any method submitted for this project. Additionally, the use of auto is not permitted. You must write the necessary programming statements/logic to accomplish each task. No credit will be given for using existing methods (thereby avoiding the need to write the programming statements) to accomplish the assigned tasks.
    Deductions
    One-time 10pt deduction: Any method contains multiple return statements.
    One-time 10pt deduction: Submission does not contain detailed comments, using appropriate terminology to explain code solutions.

  • “Parallel Task Execution with Process Forking in C” Process Creation and Task Execution in C

    General Grading Guidelines:
    The following deductions will apply to all programming assignments.
    1. Any program that does not compile will result in a zero for the assignment. No exceptions will be made for ‘accidental’ uploads, so check your code before submitting.
    2. Poor Formatting and programming style will result in a 15% deduction. Please see the style guidelines to avoid this deduction.
    3. The code will go through 2 steps of plagiarism detection. Zero tolerance for academic misconduct! If you commit any form of academic misconduct in this course, you WILL be reported to the FIU Student Conduct and Academic Affairs office.
    Programming Style Guidelines:
    The major purpose of programming style guidelines is to make programs easy to read and understand. Good programming style helps make it possible for a person knowledgeable in the application area to quickly read a program and understand how it works.
    1. Your program should begin with a comment that briefly summarizes what it does. For this course, this comment should also include your Name and pantherID.
    2. Use additional comments when needed in order for a reader to understand what is happening (see also, point 3).
    3. Variable names and function names should be sufficiently descriptive so that a knowledgeable reader can easily understand what the variable means and what the function does. If this is not possible, comments should be added to make the meaning clear.
    4. Use consistent indentation to emphasize block structure.
    5. Use names of moderate length for variables. Most names should be between 2 and 12 letters long.
    6. Use either underscores or capitalization (camelNaming) for compound names for variables. e.g: tot_vol, total_volumn, or totalVolumn. Assignment description :
    Task:
    Write a C program that simulates a parallel task execution scenario using process forking. The program should create a specified number of child processes, each performing a unique task. The parent process should wait for all child processes to complete before displaying the final result.
    Requirements:
    Your program should take an integer input n from the user, where n represents the number of child processes to be created. n should be less than 5.
    Each child process should perform a different task, such as computing the factorial of a number, finding prime numbers in a range, or any computationally intensive operation.
    The parent process should display a message before creating (forking) the child processes.
    Each child process should print its own identifier (PID) and the task it is performing.
    After completing their tasks, each child process should print a completion message.
    The parent process should wait for all child processes to finish before displaying a final message.
    Additional Considerations:
    Use the fork() system call to create child processes.
    You may use other relevant system calls or functions as needed (e.g., wait() , exit() ).
    Ensure proper error handling for system calls.
    Design the code to guarantee the creation of exactly n children, ensuring that each child executes its intended task. Properly manage the process creation to avoid any unintended duplication or omission of child processes.
    Submission Guidelines: Submit the C source code along with a brief report explaining the design choices and the lessons learned during the implementation. Discuss any challenges encountered and how they were addressed.
    Sample output:
    $ ./parallel_execution
    Enter the number of child processes to create: 3
    Parent process (PID: 1234) is creating 3 child processes.
    Child 1 (PID: 1235) is computing the factorial of 5.
    Child 2 (PID: 1236) is finding prime numbers up to 20.
    Child 3 (PID: 1237) is performing a custom task.
    Child 1 (PID: 1235) completed its task. Result: 120
    Child 2 (PID: 1236) completed its task. Result: 2 3 5 7 11 13 17 19
    Child 3 (PID: 1237) completed its task. Result: Custom task completed.
    All child processes have completed. Parent (PID: 1234) is displaying the final message.
    Deliverables:
    your C source code (e.g. myfirstlastname.c ) and PDf report.
    Remember to include the following as a comment at the beginning of your program:
    Your name
    Your panther ID
    GETTING STARTED:
    you can use this to get started:
    Ocelot Access:Your code will be tested on a Linux machine with gcc compiler. If you are not familiar with Linux here is some useful information:
    pwd – tells you the directory you are in.
    cd – changes directories.
    mkdir – creates a new directory.
    emacs and nano (and vi) – are available editors with nano easiest to use.
    The compiler is gcc.
    PA1
    PA1
    CriteriaRatingsPts
    This criterion is linked to a Learning OutcomeProcess Creation
    15 ptsFull Marks
    Properly use the fork() system call to create n child processes.
    0 ptsNo Marks
    15 pts
    This criterion is linked to a Learning OutcomeTask Execution
    15 ptsFull Marks
    Ensure that each child process executes its intended task correctly.
    0 ptsNo Marks
    15 pts
    This criterion is linked to a Learning OutcomeSynchronization
    10 ptsFull Marks
    Use appropriate synchronization mechanisms to ensure the parent process waits for all child processes to complete.
    0 ptsNo Marks
    10 pts
    This criterion is linked to a Learning OutcomeCommenting
    5 ptsFull Marks
    Adequate and meaningful comments throughout the code, explaining complex sections or logic.
    0 ptsNo Marks
    5 pts
    This criterion is linked to a Learning OutcomeIndentation and Formatting
    5 ptsFull Marks
    Follow consistent indentation and formatting guidelines for improved code readability.
    0 ptsNo Marks
    5 pts
    This criterion is linked to a Learning OutcomeVariable and Function Naming
    5 ptsFull Marks
    Use descriptive names for variables and functions, enhancing code clarity.
    0 ptsNo Marks
    5 pts
    This criterion is linked to a Learning OutcomeCode Modularity
    5 ptsFull Marks
    Divide the code into well-defined functions to enhance reusability and maintainability.
    0 ptsNo Marks
    5 pts
    This criterion is linked to a Learning OutcomeSystem Call Error Handling
    10 ptsFull Marks
    Properly handle errors that may occur during system calls (e.g., fork(), wait()).
    0 ptsNo Marks
    10 pts
    This criterion is linked to a Learning OutcomeCommand Line Input Validation
    5 ptsFull Marks
    Validate command line input to ensure a positive integer less than 5 is provided.
    0 ptsNo Marks
    5 pts
    This criterion is linked to a Learning OutcomeCorrect Output
    10 ptsFull Marks
    Ensure that the program produces the correct output, including child process identifiers, task execution, and final messages.
    0 ptsNo Marks
    10 pts
    This criterion is linked to a Learning OutcomeOutput Formatting
    5 ptsFull Marks
    Ensure clear and readable output presentation.
    0 ptsNo Marks
    5 pts
    This criterion is linked to a Learning OutcomeQuality of Report
    5 ptsFull Marks
    Submit a clear and concise report discussing design choices, challenges faced, and lessons learned during the implementation.
    0 ptsNo Marks
    5 pts
    This criterion is linked to a Learning OutcomeReflection
    5 ptsFull Marks
    Reflect on the overall learning experience and improvements that could be made.
    0 ptsNo Marks
    5 pts
    Total Points: 100

  • “Rental Management Console Application for Machinery, Tools, and Labor”

    https://github.com/SzakiSzakeszKadar/Another_Try_p…
    I. Specification Task description: The purpose of the administrative interface is to create a console application (hereinafter referred to as the application) that allows the operator to manage the rental of machinery, tools, and even labor. The application also enables the compilation and recording of orders, as well as the inventory management and data handling in files. Inputs and outputs:
    Inputs: Order data: type and quantity of machines or tools, rental duration, need for machine operators or workers. Data necessary for updating inventory records.
    Outputs: Quotation based on the order: includes rental fees and other costs. Order confirmation and recording: includes the details of the order and the confirmation of acceptance. Inventory record updates and display: display and update of current inventories. Operating conditions: The application must be able to receive, compile, and record orders. Automatic inventory updates with every new order or cancellation. Data storage and management in files. Display and management of active rentals. Clarification of circumstances: The administrator’s task is to receive and record orders, prepare quotations, and manage active rentals. Inventory updates occur automatically with every order or cancellation. Data is stored and managed in files, allowing easy access and management by the administrator. The application must have a user-friendly interface that assists the administrators in their work. Detailed functions:
    Order management: The administrator receives and records the renters’ orders and prepares quotations based on the provided data.
    Inventory management: The application automatically updates the inventories with every new order or cancellation and allows for their viewing and management.
    Data management in files: The administrator can store and manage data in files, allowing for easy access and modification.
    Active rental management: The administrator can view active rentals and, if necessary, modify or delete them.