CS411 Assignment 3 Solution and Discussion

  • Cyberian's Gold

    Visual Programing (CS411)
    Assignment#03 (GRADED)
    Total marks = 20
    Deadline Date = 23-01-2020
    Please carefully read all the instructions carefully before attempting the assignment.
    Problem Statement:
    Develop a WPF application in C# with the following functionality:
    • Create a Thread using threadpool.
    • It will also utilize the stopwatch for thread time execution calculation.
    • When the application starts the following window appears:
    One Text Box:
    Your application will have textbox for input field along with label:
    Student ID(Last 4 digit)
    This will input Last Four digit of your VUID i.e. VUID:123456789
    It will take6789 as input
    One Button:
    Start writing to file (This button will write data to text file named: output.txt)
    One Label:
    A final label for showing the time consumed by threadpool to write in text file
    Working Procedure:
    • Clicking the button “Start writing to file “will create the thread using threadpool and start the timer (Stopwatch).
    • This thread will execute a process having a for loop
    • For loop will execute number of times enterd in textbox (VUID last 4 digit value)
    • Then Label will show time consumed while writing into text file.

    Write your own VU id in the application name and id fields while creating .gif file, otherwise your assignment will not be accepted.
    Output.gif has been attached with this Assignment file please observe this file carefully your program’s output must be like this output file.
    Submission details
    Following Files Must be submitted in a single zip or rar file.
    • .C# code file
    • .XAML File (Front End file)
    • Text file (named as your (output.txt)
    • A .gif file which shows Run phase of your Application (For Recording .gif a software named Screentogif is uploaded on LMS, or you can use any other gif recording tool as well)
    You are not required to submit the complete project, only copy these three files from project folder. Please note if you submit doc file you will be awarded 0 marks.
    If you do not submit any of the above mentioned file 25% marks per file will be deducted.

  • Cyberian's Gold

    @zareen said in CS411 Assignment 3 Solution and Discussion:


    public static class ThreadPool


    using System;
    using System.Threading;
    public class Example 
        public static void Main() 
            // Queue the task.
            Console.WriteLine("Main thread does some work, then sleeps.");
            Console.WriteLine("Main thread exits.");
        // This thread procedure performs the task.
        static void ThreadProc(Object stateInfo) 
            // No state object was passed to QueueUserWorkItem, so stateInfo is null.
            Console.WriteLine("Hello from the thread pool.");
    // The example displays output like the following:
    //       Main thread does some work, then sleeps.
    //       Hello from the thread pool.
    //       Main thread exits.
    void WaitCallback(Object state)


  • Cyberian's Gold

    var watch = System.Diagnostics.Stopwatch.StartNew();              
    for (int i = 0; i < 1000; i++) {     
    }  watch.Stop();  
    Console.WriteLine($"Execution Time: {watch.ElapsedMilliseconds} ms");

  • Cyberian's Gold

Quiz 100% Result Quiz 100% Result
| |