Skip to content

CS411 - Visual Programming

7 Topics 31 Posts
  • 0 Votes
    5 Posts
    2k Views
    zaasmiZ

    @zaasmi said in CS411 Assignment 1 Solution and Discussion:

    e65f2192-00ef-48b9-badf-5e82a47c3b60-image.png
    Visual Programming (CS411)
    Assignment # 01
    Total marks = 20

    Deadline Date:
    9th December, 2021

    Please carefully read the following instructions before attempting assignment.
    RULES FOR MARKING
    It should be clear that your assignment would not get any credit if:
    • The assignment is submitted after the due date.
    • The submitted assignment does not open or file is corrupt.
    • Strict action will be taken if submitted solution is copied from any other student or from the internet.

    Lectures:

    • Lectures 1 to 6 are covered in this assignment
    NOTE
    No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding or internet malfunctioning etc.). Hence refrain from uploading assignment in the last hour of deadline. It is recommended to upload solution file at least two days before its closing date.
    If you people find any mistake or confusion in assignment (Question statement), please consult with your instructor before the deadline. After the deadline no queries will be entertained in this regard.
    For any query, feel free to email at: [email protected]

    (Marks 20)

    Problem Statement:
    You are required to create a C# Console application using Visual Studio.
    Your code should be able to calculate price for sacrificial animals that can be goat, sheep and camel separately while using the concept of POLYMORPHISM.
    • Your code should work in such a way that you need to create 3 classes, one parent class i.e. Animal and other three derived classes that will be goat, sheep and camel.
    • The function that needs to be override would be of Price Calculation.
    • So, your code should work in such a way that at first you should enter the last NUMERIC character of your vu id as a number of animals you want to buy. (Note: You should also check if the last numeric character of your vu id is zero then your code should increment it with 1 so in any case your code should atleast buy one animal). After that, you should be asked for the first five numeric characters of your VUID which will be later used as a rent. Rent will be included in the price of animal that we will hard code.
    • Now you need to make a menu/options as shown in the screenshot below, which will ask you if you want to calculate price for the sheep then press 1, if you want to calculate price for goat press 2, if you want to calculate price for camel then press 3, OR if you want to quit simply press 0 (Note: Your Loop should break when user presses 0)
    • Your loop should run exactly the same number of times as you have entered for the number of animals you want to buy i.e. last numeric character of your vu id.
    • You can use hard-coded values for the price of sheep, goat and camel like 50,000, 80,000, 100,000 respectively.
    • Formula to calculate price is: Total Price = rent+price (according to the animal selected)
    • Your output should be exactly same as shown in the screenshot below.
    Required Output:
    6ce1968f-49ce-497e-92b2-a050740f19c3-image.png

    Note:
    DO REMEMBER that you must use your VUID as an input in this program.

    Submission details
    Following Files Must be submitted in a single zip or rar file.
    • .cs code file (file name should be your VUID)
    • Screenshot of your output.
    You are not required to submit the complete project, only copy required file from project folder.
    If you do not submit any of the above-mentioned file you will be awarded Marks partially.

    “The End”

  • 0 Votes
    5 Posts
    352 Views
    zaasmiZ

    @zaasmi
    Universal Windows Platform (UWP)
    UWP provides a common type system, APIs, and application model for all devices running on Windows 10. So, UWP enables development of universal apps for PC, tablet, Xbox, Surface Hub, HoloLens, or Internet of Things (IoT) devices.

    UWP app developers get access to the Microsoft store that charges only 15 percent for non-gaming subscription-based apps, unlike Google Play Store and App Store. Other services include an execution environment (AppContainer) and Extension SDKs to call specialized APIs for different devices.

  • 0 Votes
    2 Posts
    230 Views
    zaasmiZ

    Please share idea

  • 0 Votes
    4 Posts
    1k Views
    zareenZ

  • 0 Votes
    4 Posts
    1k Views
    zareenZ

    @zareen said in CS411 Assignment 3 Solution and Discussion:

    threadpool

    public static class ThreadPool

    Examples

    using System; using System.Threading; public class Example { public static void Main() { // Queue the task. ThreadPool.QueueUserWorkItem(ThreadProc); Console.WriteLine("Main thread does some work, then sleeps."); Thread.Sleep(1000); 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)

    Source

  • 0 Votes
    4 Posts
    242 Views
    zareenZ

    Main Code File

    string stringToSearch = TextBox1.Text; string[] lines = File.ReadAllLines(@"H:/james.txt"); foreach (string line in lines) { if (line.IndexOf(stringToSearch) >= 0) { Label1.Content = line; break; } else { Label1.Content = "VU ID Not Found"; } }

    XAML File

    <Window x:Class="CS411_Assign.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <TextBox x:Name="TextBox1" HorizontalAlignment="Left" Height="23" Margin="165,87,0,0" TextWrapping="Wrap" Text="" VerticalAlignment="Top" Width="237"/> <Button Content="Search" HorizontalAlignment="Left" Margin="165,153,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_1"/> <Label x:Name="Label1" Content="Data" HorizontalAlignment="Left" Margin="165,206,0,0" VerticalAlignment="Top" Width="222"/> <Label Content="Vu-Student Id" HorizontalAlignment="Left" Margin="10,87,0,0" VerticalAlignment="Top"/> </Grid> </Window>
  • 0 Votes
    7 Posts
    207 Views
    zaasmiZ

    100% Solved:

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Student { public int x; public Student() { } public Student(int i) { x = i; // y = j; } /* public void Showsum() private int sum1 = x + y; { Console.WriteLine(sum1); }*/ public static Student operator +(Student ss, Student ss2) { Student temp = new Student(); temp.x = Int32.Parse(ss.x.ToString() + ss2.x.ToString()); return temp; // return temp = tostring(d1) + tostring(d2); } public static Student operator * (Student ss, Student ss2) { double d= (double)ss.x; double dd = (double)ss2.x; Student temp = new Student(); double result= Math.Pow( d ,dd); temp.x =(int) result; return temp; // return temp = tostring(d1) + tostring(d2); } class Program { static void Main(string[] args) { Student s1 = new Student(2); //S1.Showsum(); // displays 15 Student s2 = new Student(4); Student s3 = s1 + s2; Console.WriteLine(s3.x.ToString()); Student s4 = s1 * s2; Console.WriteLine(s4.x.ToString()); Console.Read(); //S2. } } } }

    assignment1gif.gif

    ConsoleApplication1.zip