CS411 Assignment 1 Solution and Discussion


  • Cyberian's Gold

    Re: CS411 Assignment 1 Solution and Discussion

    Visual Programming (CS411)
    Assignment # 1 (GRADED)
    Total marks = 20 Due Date = 1st June 2020
    Please carefully read the following instructions before attempting the assignment.

    1. First of all listen to the video lectures.
    2. After that consult handouts and recommended books to clarify your concepts.
    3. You are supposed to submit your complete solution project as a single file (i. e. zip or RAR). Any other formats like scan images, PDF, bmp, docx etc. will not be accepted.
    4. It should be clear that your assignment would not get any credit if:
      • The assignment is submitted after due date.
      • The submitted assignment does not open or file is corrupt.
      • The assignment is copied. Note that strict action would be taken if the submitted assignment is copied from any other student. Both students will be punished equally.

    Important Note:
    Assignment comprises of 20 Marks. Note that no assignment will be accepted after due date via email in any case (whether it is the case of load shedding or emergency electric failure or internet malfunctioning etc.). Hence, refrain from uploading assignment in the last hour of the deadline and try to upload Solutions at least 02 days before the deadline to avoid any inconvenience.
    For any query please contact: [email protected]
    Problem Statement:
    You are required to create a C# application Console using Visual Studio with the following functional requirements:
    Create 4 classes:

    1. Bowler 2.Spinner 3.Medium 4.Fast

    Each class will have a function named “speed” which will output speed as specified by class name.

    61de52b5-256a-4c18-bdc1-b9b80335cdbe-image.png
    You will program this as follows

    • You will take as an input the last two digit of your VUID. For example your ID is BC123456789 so you take here “89” as input and program will decide which range it belongs to i.e. Fast, Medium, Spinner
    • For this you create bowler type object and later on initialize it with spinner, medium and fast bowler as per below provided ranges.
     Spinner pace bowler has range of 00 to 33
     Medium pace bowler has range of 34 to 66
     Fast pace bowler has range of 67 to 100
    • If bowler pace is not in the specified range then the object type must be bowler.
    Further, if any user tries to enter alphabetical value, it should through Exception and let the user to enter a new numeric value.

    Note: Program must show your own VUID usage.

    Submission details
    Following Files Must be submitted in a single zip or rar file.
    • .C# code file (file name should be your VUID)
    • A .gif file which shows only “execution” 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 required file from project folder.
    If you do not submit any of the above-mentioned file you will be awarded Marks partially.


  • Cyberian's Gold

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace bc160
    {
    
        class Bowler
        {
            public virtual void speed()
            {
                Console.WriteLine("Only enter last two digit your id");
    
            }
        }
    
        class Spinner : Bowler
        {
            public override void speed()
            {
                Console.WriteLine("spinner pace bolwer");
    
            }
        }
    
        class Mediam : Bowler
        {
            public override void speed()
            {
                Console.WriteLine("Mediam pace bolwer");
    
            }
        }
    
        class Fast : Bowler
        {
            public override void speed()
            {
                Console.WriteLine("Fast pace bolwer");
    
            }
        }
    
    
        class Program
        {
            static void Main(string[] args)
            {
    
                Bowler b1 = new Bowler();
    
            enter:
                Console.WriteLine("Enter last two digit your id");
                String num = Console.ReadLine();
                try
                {
                    int vuid = Int32.Parse(num);
                    if (vuid >= 00 && vuid <= 33)
                    {
                        b1 = new Spinner();
                        b1.speed();
                    }
                    else if (vuid > 33 && vuid <= 66)
                    {
                        b1 = new Mediam();
                        b1.speed();
                    }
                    else if (vuid > 66 && vuid <= 100)
                    {
                        b1 = new Fast();
                        b1.speed();
                    }
                    else
                    {
                        b1.speed();
                    }
                }
                catch (FormatException)
                {
                    Console.WriteLine("Enter an integer number only", num);
                    goto enter;
                }
                Console.ReadKey();
            }
        }
    }
    

    Complete Solution File Spring 2020_CS411_1_SOL


  • Cyberian's Gold

    This post is deleted!


Quiz 100% Result Quiz 100% Result
| |