全文预览

c#程序设计教程(课后习题答案代码)

上传者:梦&殇 |  格式:doc  |  页数:26 |  大小:155KB

文档介绍
ystem.Collections.Generic; using System.Text; namespace Proj7_15 { public class Employee { private double bsalary= 1000; private double psalary; private int n; public int pn { get { return n;} set {n= value ;} } public psalary() { Console .Write( "工作年数:" ); pn= int .Parse( Console .ReadLine()); psalary = bsalary+30*pn; return psalary; }} public class UEmployee : Employee { new public psalary() { return 1.5 * base .compsalary(); }} class Program { static void Main( string [] args) { Employee emp1 = new Employee (); Console .WriteLine( "该普通职工工资:{0}" , psalary()); UEmployee emp2 = new UEmployee (); Console .WriteLine( "该本科生职工工资:{0}" , psalary()); }}}课本 157 页8 public class Employee //普通职工类{ private double bsalary = 1000; //基本工资 private double psalary; //实际工资 private int n; //工作年数 public int pn

收藏

分享

举报
下载此文档