第一章上機練習3 完成MyBank系統的開戶業務
阿新 • • 發佈:2019-01-26
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyBank { public class User { public string name; public string pwd; public string ID; public double money; public string zhanghu="56564624626"; public void Show() { Console.WriteLine("賬戶:{0},使用者名稱:{1},存款金額{2}建立成功!", zhanghu, name, money); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyBank { class Bank { public void zhanghu() { User user = new User(); Console.WriteLine("請輸入使用者名稱:"); user.name = Console.ReadLine(); Console.WriteLine("請輸入使用者密碼:"); user.pwd = Console.ReadLine(); Console.WriteLine("請輸入使用者身份證號碼:"); user.ID = Console.ReadLine(); Console.WriteLine("請輸入使用者存款金額:"); user.money = double.Parse(Console.ReadLine()); user.Show(); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace MyBank { class Class1 { static void Main(string[] args) { Bank b = new Bank(); b.zhanghu(); Console.ReadLine(); } } }