CS411 Visual Programming Assignment 1 Solution 2020
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace mc180200940
{
class Bowler
{
public virtual void speed();
Console.WriteLien(“unknow bowler”);
Console.Readkey();
}
}
class Spinner : Bowler
public override void speed()
{
Console.WriteLien(“spinner pace bolwer”);
Console.Readkey();
}
class Mediam : Bowler
public override void speed()
{
Console.WriteLien(“Mediam pace bolwer”);
Console.Readkey();
class Fast : Bowler
public override void speed()
{
Console.WriteLien(“Fast pace bolwer”);
Console.Readkey();
class program
static void Main(string[] args)
{
Bowler bowler1;
Console.Write(“Enter last two digit your id”);
String id = Console.ReadLine();
int Idd;
if(int.Tryparse(id, out idd))
{
if(Idd > 00 && idd <= 33)
{
bowler1 =new Spinner();
bowler1.speed();
}
else if (Idd > 33 && idd <= 66)
{
{
bowler1 =new Mediam();
bowler1.speed();
{
else if (Idd > 66 && idd <= 100)
{
{
bowler1 =new Fast();
bowler1.speed();
{
else
{
bowler1 = new bowler();
bowler1.speed();
}
}
else
}
Console.WriteLine(“you have enter invalid value”);
Console.ReadKey();
}
}
}
}
}
}
CS411 Assignment 1 IDEA SOL SPRING 2020
-
-
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();}}}
-