using System;
using System.Collections.Generic;
using System.Text;
namespace shuzu
{
class Book
{
private readonly string isbn;
private string title;
private string author;
private double tradePrice;
private string stockNumber;
private double salePrice;
public Book(string isbn)
{
this.isbn = isbn;
this.title = "未知";
this.author = "未知";
this.tradePrice = 0;
this.stockNumber = "未知";
this.salePrice =0;
}
public Book(string isbn, string title, string author, double tradePrice, string stockNumber, double salePrice)
{
this.isbn = isbn;
this.title = title;
this.author = author;
this.tradePrice = tradePrice;
this.stockNumber = stockNumber;
this.salePrice = salePrice;
}
public string ISBN
{
get { return isbn; }
}
public string Title
{
get { return title; }
set { title = value; }
}
public string Author
{
get { return author; }
set { author = value; }
}
public double TradePrice
{
get { return salePrice; }
set { tradePrice = value; }
}
public string StockNumber
{
get { return stockNumber; }
set { stockNumber = value; }
}
public double SalePrice
{
get { return salePrice; }
set { salePrice = value; }
}
public void show()
{
Console.WriteLine("书号:{0}", isbn);
Console.WriteLine("标题:{0}", title);
Console.WriteLine("作者:{0}", author);
Console.WriteLine("批发价(零售价的70%):{0}", 7*salePrice/10);
Console.WriteLine("库存量:{0}", stockNumber);
Console.WriteLine("零售价:{0}", salePrice);
}
class Text
{
static void Main(string[] args)
{
Console.WriteLine("请输入isbn书号:");
Book book1 = new Book(Console.ReadLine());
book1.show();
Console.ReadLine();
Console.WriteLine("请输入标题:");
book1.Title = Console.ReadLine();
Console.WriteLine("请输入作者:");
book1.Author = Console.ReadLine();
Console.WriteLine("请输入库存量:");
book1.StockNumber = Console.ReadLine();
Console.WriteLine("请输入零售价:");
book1.SalePrice = Convert.ToDouble(Console.ReadLine());
book1.show();
}
}
}
}
温馨提示:内容为网友见解,仅供参考