C#VisualStudio2008实验报告附源代码usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;1、创建C#控制台应用程序。设计一个简单的密码验证程序,若密码正确,则显示“欢迎进入本系统!”,否则显示“密码输入错误,请重新输入!”。若连续三次密码输入错误,则显示“对不起,超过最多输入次数,取消服务!”,程序退出。namespaceConsoleApplication1{classProgram{staticvoidMain(string[]args){inti=0;stringmima=123321;boolk=true;Console.WriteLine();Console.WriteLine(》》》》欢迎使用本系统《《《《\n\n);Console.WriteLine(请输入您的服务密码:);while(k){stringget=Console.ReadLine();if(get!=mima){i++;if(i==3){Console.WriteLine(对不起,输入的密码错误次数超过三次,\n\n已取消服务,请按任意键结束!!);Console.ReadLine();break;}elseConsole.WriteLine(对不起,密码有误,已经输入{0}次,请重新输入!,i);}else{Console.WriteLine(欢迎进入本系统!!);Console.ReadLine();break;}}}}}usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;4.定义一个shape抽象类,利用它作为基类派生出Rectangle、Circle等具体形状类,已知具体形状类均具有两个方法GetArea和GetPerim,分别用来求形状的面积和周长。最后编写一个测试程序对产生的类的功能进行验证。namespaceshiyan14{publicabstractclassShape{publicdoubleGetArea(){return0;}publicdoubleGetPerim(){return0;}}publicclassCircle:Shape{privatedoubler;publicCircle(doublea){r=a;}publicnewdoubleGetArea(){returnMath.PI*r*r;}publicnewdoubleGetPerim(){returnMath.PI*2*r;}}publicclassRectangle:Shape{privatedoublea,b;publicRectangle(doublec,doubled){a=c;b=d;}publicnewdoubleGetArea(){returna*b;}publicnewdoubleGetPerim(){return(2*(a+b));}}classProgram{staticvoidMain(string[]args){Circlestr=newCircle(3);Rectanglech=newRectangle(5,10);Console.WriteLine(\n\0圆的半径初始化为:R=3\n);Console.WriteLine(=圆的面积为:{0}\n,str.GetArea());Console.WriteLine(=圆的周长为:{0}\n,str.GetPerim());Console.WriteLine(\n\0初始化长方形长为:10,宽为:5\n);Console.WriteLine(=长方形面积:{0}\n,ch.GetArea());Console.WriteLine(=长方形周长:{0}\n,ch.GetPerim());Console.Read();}}}编程实现一个模拟闹铃的程序,具有闹铃、继续闹铃、打会盹儿,停止闹铃的功能usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceshiyan15{publicclassclock{System.Media.SoundPlayermusic;publicvoidalarm(){music=newSystem.Media.SoundPlayer(Track06.wav);music.Play();}publicvoidgoon(){music=newSystem.Media.SoundPlayer(Track06.wav);music.Play();}publicvoidrest(){music.Stop();System.Threading.Thread.Sleep(15000);music=newSystem.Media.SoundPlayer(Track06.wav);music.Play();}}classProgram{staticvoidMain(string[]args){clocka=newclock();Console.WriteLine(\n\n=======主菜单========);Console.WriteLine(\n\n1:闹铃);Console.WriteLine(\n\n2:继续闹铃);Console.WriteLine(\n\n3:稍后闹铃);Console.WriteLine(\n\n4:停止闹铃);Console.WriteLine(\n请输入您要选择的编号);inti=Console.Read();Console.ReadLine();if(i==1)Environment.Exit(0);a.alarm();System.Console.Clear();Console.WriteLine(\n\n=======主菜单========);Console.WriteLine(\n\n2:继续闹铃);Console.WriteLine(\n\n3:稍后闹铃);Console.WriteLine(\n\n4:停止闹铃);Console.WriteLine(\n您还需要的服务为);Console.ReadLine();if(i==2)Environment.Exit(0);a.goon();System.Console.Clear();Console.WriteLine(\n\n========主菜单=======);Console.WriteLine(\n\n1:闹铃);Console.WriteLine(\n\n3:稍后闹铃);Console.WriteLine(\n\n4:停止闹铃);Console.WriteLine(\n您还需要的服务为);Console.ReadLine();if(i==3)Environment.Exit(0);a.rest();System.Console.Clear();Console.WriteLine(\n\n=======主菜单========);Console.WriteLine(\n\n1:闹铃);Console.WriteLine(\n\n2:继续闹铃);Console.WriteLine(\n\n4:停止闹铃);Console.WriteLine(\n您还需要的服务为);Console.ReadLine();if(i==4){Environment.Exit(0);Console.WriteLine(已停止闹铃!!!);Console.ReadLine();}}}}创建一个点Point类,属性包括横坐标、纵坐标。要求能够完成点的移动操作、求两点距离操作,并利用运算符重载,对两个点进行比较(相等和不等)依据是两坐标点相等指它们横坐标和纵坐标分别相等。编写一个测试程序对产生的类的功能进行验证。usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespace_1_2{classpoint{publicdoublex,y;publicpoint(doublea,doubleb){x=a;y=b;}publicvoidmove(doublea,doubleb){x=x+a;y=y+b;}publicstaticbooloperator==(pointa,pointb){if((a.x==b.x)&&(a.y==b.y))returntrue;elsereturnfalse;}publicstaticbooloperator!=(pointa,pointb){if((a.x!=b.x)||(a.y!=b.y))returntrue;elsereturnfalse;}publicdoubledistance(pointa,pointb){returnMath.Sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y));}}classProgram{staticvoidMain(){pointa=newpoint(1,1);pointb=newpoint(2,2);Console.WriteLine(a点的坐标:({0},{1}),a.x,a.y);Console.WriteLine(b点的坐标:({0},{1}),b.x,b.y);Console.WriteLine(对a坐标移动2和3,按enter确认!);a.move(2,3);Console.ReadLine();Console.WriteLine(移动后a点得坐标是:({0},{1}),a.x,a.y);Console.WriteLine(a坐标移动后与b坐标距离是:{0},a.distance(a,b));if(a==b)Console.WriteLine(a点和b点相等\n);elseConsole.WriteLine(a点和b点不相等\n);Console.WriteLine(对b坐标移动3和4,按enter确认!);b.move(1,2);Console.ReadLine();Console.WriteLine(移后b点坐标:({0},{1}),b.x,b.y);if(a==b)Console.WriteLine(a点和b点相等);elseConsole.WriteLine(a点和b点不相等);Console.ReadLine();}}}定义一个顺序表SqlList类,要求能够完成在顺序表中插入元素和删除元素,确定元素在顺序表中位置,检索元素,清空表,判断表是否为空等操作。编写一个测试程序进行验证。usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceshiyan13{classSqlList{privateint[]list;privateintlen;publicSqlList(int[]a,intb){list=a;len=b;}publicvoidprint(){for(inti=0;ilen;i++){Console.Write({0}\0,list[i]);}}publicboolinsert(intc,intd){inttemp=0,i=d-1;for(;ilen;i++){temp=list[i];list[i]=c;c=temp;}if(dlen||d1){Console.WriteLine(\n对不起,插入位置有误,重新输入插入位置!);returnfalse;}returntrue;}publicbooldelete(inte){intj=e;for(;jlen;j++)list[j-1]=