C#--编写旅行社程序
来源:互联网 发布:centos搭建lamp 编辑:程序博客网 时间:2024/06/08 14:13
1、代码:
using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace travel{ public class Travel{ private int tourCost =0; private string location; public int TourPrice { get { if ( location == "加利福尼亚") return tourCost = 250; if (location == "北京") return tourCost = 190; else return tourCost = 0; } } public string Location { get { return location; } set { if (value != "加利福尼亚" && value != "北京") { location = null; } else location = value; } } } class Program { static void Main(string[] args) { Travel dizhi=new Travel(); Console.WriteLine("请输入你要去旅游的地方"); dizhi.Location=Console.ReadLine(); Console.WriteLine("费用是" + dizhi.TourPrice); } }}
2、实验结果截图:
0 0
- C#--编写旅行社程序
- emacs编写C程序
- C语言程序编写
- C语言程序编写
- 【C#】程序编写规范
- Linux 编写C程序
- 用c编写cgi程序
- 用c编写cgi程序
- linux编写c程序发现
- 用c 编写mex 程序
- C/c++程序编写心得
- C语言编写时钟程序
- C语言编写五子棋程序
- Xcode编写C/C++程序
- C语言编写CGI程序
- c程序编写过程流程
- 编写优质嵌入式C程序
- 用C编写mex程序
- Codeforces Round #374 (Div. 2) C. Journey
- 7天入门php-多维数组、Date、Include
- R中的排序
- 浏览器地址栏主机IP混淆写法
- HDJacm 1276士兵队列的训练问题 错误总结
- C#--编写旅行社程序
- Java Thumbnails图片处理速度慢
- html中的块级元素和行内元素
- 哈希表存储效率一般不超过50%
- 移动端qq登录和网页qq登录返回的qqOpenId不同
- mac版MySQL初始密码或者自己的密码忘了怎么办?
- Android Support Design库之FloatingActionButton
- 374. Guess Number Higher or Lower
- 关于后台从阿里云获取文件的一些思考