小商品管理系統mysql實現 小商品管理系統

2021-10-17 21:35:46 字數 4315 閱讀 1862

假設某商店有如下幾種貨品:襯衣、帽子、立櫃。每一種貨物都有與其關聯的說明資訊。

襯衣:單價、產地、布料;

帽子:單價、產地、布料、樣式(平頂或尖頂);

立櫃:單價、產地、木料、顏色。

對這些商品的操作有:商品的進庫(增加某類商品及其庫存量),商品的出庫(減少某類商品及其庫存量),某類貨品總**的計算。

要求自行設計資料結構,用類的繼承與派生關係將上述的各種貨品表示出來,並使用類的建構函式來初始化每一類物件的初始資料。而後將上述的商品管理計算機化,完成操作要求的功能。

二、實驗過程(實驗步驟、記錄、資料、)

#include

#include

using namespace std;

class shirt

public:

shirt(double p=21,int n=21,string a="江西",string c="棉質"):price(p),num(n),area(a),cloth(c){}

friend shirt operator + (shirt &sh,int a);

shirt operator - (int a);

void input();

void output();

void change();

double sum();

double price;

int num;

string area;

string cloth;

class hat:public shirt

public:

hat(double p=21,int n=21,string a="江西",string c="棉質",string h="平頂"):shirt(p,n,a,c),stytle(h){}

friend hat operator + (hat &h1,int a);

hat operator - (int a);

void input();

void output();

void change();

// double sum();

string stytle;

class closet :public shirt

public:

closet(double p=21,int n=21,string a="江西",string c="白樺",string h="紫色"):shirt(p,n,a,c),tree(c),colour(h){}

void input();

void output();

// double sum();

void change();

string tree;

string colour;

double shirt::sum()

return num*price;

void shirt::input()

cout<

cin>>price;

cout<

cin>>num;

cout<

cin>>area;

cout<

cin>>cloth;

void shirt::output()

cout<

cout<

cout<

cout<

void hat::input()

cout<

cin>>price;

cout<

cin>>num;

cout<

cin>>area;

cout<

cin>>cloth;

cout<

cin>>stytle;

void hat::output()

cout<

cout<

cout<

cout<

cout<

void closet::input()

cout<

cin>>price;

cout<

cin>>num;

cout<

cin>>area;

cout<

cin>>tree;

cout<

cin>>colour;

void closet::output()

cout<

cout<

cout<

cout<

cout<

void change(shirt &s1,hat &h1,closet &c1)

int a;

cout<

cout<

cin>>a;

switch(a)

case 1: s1.change();break;

case 2:h1.change();break;

case 3:c1.change();break;

void shirt::change()

string c,c1;int a;

cout<

cin>>c;

if(c=="單價")

{cout<>price;cout<

else if (c=="數量")

cout<>c1;

if(c1=="增加")

{cout<>a;num=num+a;cout<

else if(c1=="減少")

{cout<>a;num=num-a;cout<

else if(c=="產地")

{cout<>area;cout<

else if(c=="布料")

{cout<>cloth;cout<

void hat::change()

string c,c1;int a;

cout<>c;

if(c=="單價")

{cout<>price;cout<

else if (c=="數量")

cout<>c1;

if(c1=="增加")

{cout<>a;num=num+a;cout<

else if(c1=="減少")

{cout<>a;num=num-a;cout<

else if(c=="產地")

{cout<>area;cout<

else if(c=="布料")

{cout<>cloth;cout<

else if(c=="樣式")

{cout<>stytle;cout<

void closet::change()

string c,c1;int a;

cout<>c;

if(c=="單價")

{cout<>price;cout<

else if (c=="數量")

cout<>c1;

if(c1=="增加")

{cout<>a;num=num+a;cout<

else if(c1=="減少")

{cout<>a;num=num-a;cout<

else if(c=="產地")

{cout<>area;cout<

else if(c=="布料")

{cout<>tree;cout<

else if(c=="顏色")

{cout<>colour;cout<

void sum(shirt &s1,hat &h1,closet &c1)

cout<

s1.output();

h1.output();

c1.output();

cout<

cout<

cout<

int main()

shirt  s1,s2;

hat  h1,h2;

closet c1,c2;

char c;system("pause");

system("mode con cols=90 lines=40");

system("title 小商品管理");

system("color  85");

s1.output();h1.output();c1.output();

cout<

cin>>c;system("cls");system("pause");

while(c=='y')

change(s1,h1,c1);

cout<

cin>>c;system("cls");system("pause");

cout<>c;system("cls");system("pause");

if(c=='y')

sum(s1,h1,c1);

return 0;

簡單商品管理系統的實現

思路 1.先定義乙個 fruititem 類,在類中定義商品號 商品名字 單價等屬性。2.定義乙個shop類,在裡面把增刪改查和選單方法。3.在主方法中把選單方法死迴圈呼叫,用判斷語句判斷輸入選項從而實現對應的方法,按退出選項時退出死迴圈。public class fruititem 系統主類 實現...

angularjs商品管理系統

入庫 貨物名稱 貨物數量 貨物產地 貨物單價 貨物的生產日期操作 新增產品 貨物名稱 貨物數量 貨物產地 貨物單價 var aa new date scope.counts 按數量正序 按數量倒序 var good 1 scope.goods good 1 scope.xl function els...

MIS系統(6) 商品管理之SPU管理

部落格首頁 mis專 專欄目錄 介面管理 1,spu表資料獲取 2,類檢視 good spu views.py 3,序列化器 spu serializers.py 2,spu表獲取品牌資訊 2,類檢視 good spu views.py 3,序列化器 good spu serializers.py ...