Advertisement
Guest User

Bài tập

a guest
Aug 12th, 2015
327
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.77 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Cau_truc_dieu_khien
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int hma = 10;
  14.             int vip72 = 15;
  15.             int sock5 = 10;
  16.             string loai_acc = "";
  17.             string tenkhachhang = "";
  18.             int soluong = 0;
  19.             int tongtien = 0;
  20.             int tiengiam = 0;
  21.             int tien = 0;
  22.             int diemthuong = 0;
  23.             Console.WriteLine("Ban mua mua Acc gi ? (Nhap vao hma, vip72, socks5)");
  24.             loai_acc = Console.ReadLine();
  25.             Console.WriteLine("Nhap ten cua ban: ");
  26.             tenkhachhang = Console.ReadLine();
  27.             Console.WriteLine("Nhap so luong acc ban muon mua: ");
  28.             soluong = Convert.ToInt32(Console.ReadLine());
  29.             switch (loai_acc)
  30.             {
  31.                 case "hma":
  32.                     tien = hma * soluong;
  33.                     break;
  34.                 case "vip72":
  35.                     tien = vip72 * soluong;
  36.                     break;
  37.                 case "sock5":
  38.                     tien = sock5 * soluong;
  39.                     break;
  40.                 default:
  41.                     Console.WriteLine("Vui long nhap vao hma, vip72, socks5");
  42.                     break;
  43.             }
  44.             if (soluong > 0 && soluong <= 10)
  45.             {
  46.                 tiengiam = tien * 1 / 10;
  47.             }
  48.             else if (soluong > 10 && soluong <= 20)
  49.             {
  50.                 tiengiam = tien * 2 / 10;
  51.             }
  52.             else
  53.             {
  54.                 tiengiam = tien * 3 / 10;
  55.             }
  56.             if (tiengiam >= 0 && tiengiam < 100)
  57.             {
  58.                 diemthuong = diemthuong + 5;
  59.             }
  60.             else if (tiengiam >= 100 && tiengiam <= 200)
  61.             {
  62.                 diemthuong = diemthuong + 10;
  63.             }
  64.             else if (tiengiam > 200 && tiengiam <= 300)
  65.             {
  66.                 diemthuong = diemthuong + 20;
  67.             }
  68.             else
  69.             {
  70.                 diemthuong = diemthuong + 30;
  71.             }
  72.             tongtien = Convert.ToInt32(tien - tiengiam);
  73.             Console.WriteLine("==============Hoa Don Khach Hang==============");
  74.             Console.WriteLine("Xin chao " + tenkhachhang);
  75.             Console.WriteLine("Loai Acc: " + loai_acc);
  76.             Console.WriteLine("So luong Acc ban muon mua la " + soluong + " Va ban duoc giam " + tiengiam + "$");
  77.             Console.WriteLine("So tien ban phai tra la: " + tongtien + "$");
  78.             Console.WriteLine("Ban duoc cong " + diemthuong + " diem vao tai khoan");
  79.             Console.ReadLine();
  80.  
  81.  
  82.  
  83.         }
  84.     }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement