问题描述
usingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceConsoleApplication1{classProgram{publicenumdhf_zl{dhf_zj,dhf_sj}staticvoidMain(string[]args){dhfaa=newdhf();aa.dhf_yhm="zhanghua";aa.dhf_record(dhf_zl.dhf_sj,100);aa.dhf_record(dhf_zl.dhf_zj,200);Console.WriteLine("{0}要交{1:C}电话费",aa.dhf_yhm,aa.abd);}publicclassdhf{privatestringdhf_name;privatedecimaldhf_zj;publicstringdhf_yhm{get{returndhf_name;}set{dhf_name=value;}}publicvoidabd(){get{returndhf_zj;}}publicvoiddhf_kkzj(decimaldhf_kkjg){dhf_zj=-dhf_kkjg;}publicvoiddhf_record(dhf_zldhzl,intdhf_minute){switch(dhzl){casedhf_zl.dhf_sj:dhf_zj=(0.03M*dhf_minute);break;casedhf_zl.dhf_zj:dhf_zj=(0.02M*dhf_minute);break;default:break;}}}}}
解决方案
解决方案二:
publicdecimalabd{get{returndhf_zj;}}顺便说下,非常讨厌你的命名习GUAN....看了眼睛痛
解决方案三:
usingSystem;usingSystem.Collections;usingSystem.Text;namespaceConsoleApplication1{classProgram{publicenumdhf_zl{dhf_zj,dhf_sj}staticvoidMain(string[]args){dhfaa=newdhf();aa.dhf_yhm="zhanghua";aa.dhf_record(dhf_zl.dhf_sj,100);aa.dhf_record(dhf_zl.dhf_zj,200);Console.WriteLine("{0}要交{1:C}电话费",aa.dhf_yhm,aa.abd);Console.Read();}publicclassdhf{privatestringdhf_name;privatedecimaldhf_zj;publicstringdhf_yhm{get{returndhf_name;}set{dhf_name=value;}}publicdecimalabd{get{returndhf_zj;}}publicvoiddhf_kkzj(decimaldhf_kkjg){dhf_zj=-dhf_kkjg;}publicvoiddhf_record(dhf_zldhzl,intdhf_minute){switch(dhzl){casedhf_zl.dhf_sj:dhf_zj=(0.03M*dhf_minute);break;casedhf_zl.dhf_zj:dhf_zj=(0.02M*dhf_minute);break;default:break;}}}}}