EE308_Lab9

-

The Link Your Class https://bbs.csdn.net/forums/MUEE308FZ
The Link of Requirement of This Assignment https://bbs.csdn.net/topics/603386400
The Aim of This Assignmentmprove the understanding of UML
MU STU ID and FZU STU ID19104987 831901324

Question
Live-streaming sale, through some Internet platforms, is a new way of service using live-streaming technology for close commodity display, consultation response, and shopping guide. Merchants can open their own live broadcast room, or employ professional anchors to recommend goods. At present, not only many celebrities flock into this field, but some big companies’ executives are also frequently involved. Please try to design a comprehensive live-streaming sale system.
(i) List some actors that interact with this system. Explain the relevance of each actor.
Your Answer:

Administrator:Maintaining system stability
user : use the live-streaming sale system close commodity display, consultation response, and shopping guide.
Anchor :use the live-streaming sale system to recommend goods
Merchants :use the live-streaming sale system to open their own live broadcast room, or employ professional anchors to recommend goods

(ii) Prepare a use case diagram for this system.
Your Answer:

img

(iii) Prepare a normal scenario for each use case. (i.e. describe each use case in words)
Your Answer:

Users log in to the system to view products, browse shopping guides, and consult relevant information.  After the user sees the product they want to buy, they can check the product information and confirm whether to buy it or not. After selecting the purchase, they can receive the order information.

Administrators log in to the system for system maintenance.

Merchants first login system, can undertake the order management, in the system can manage their own goods, such as adding, modify or delete items goods, also can query the purchase order, and review the order details, merchants can also live on their own platform open to promote their own products to other users, can also hire other professional anchor to help promote sales.  

Anchors first log in the system, open their own live broadcast room, to recommend goods  

(iv) Prepare sequence diagrams or activity diagrams for primary scenarios. By the way, each scenario can be described by a sequence diagram or an activity diagram, but both diagrams must be used in this question.
Your Answer:

img

img

(v) Prepare a class diagram for this system. Explain which principles of object-oriented are applied in your design.
Your Answer:

img

Single Responsibility Principle (SRP): Every object should have a single responsibility, and that responsibility should be entirely encapsulated by the class.
Open-Closed Principle (OCP): Software entities should be open for extension, but closed for modification.
Interface Segregation Principle (ISP): Clients should not be forced to depend upon interfaces that they do not use.
Law of Demeter (LoD): Each unit should have only limited knowledge about other units: only units "closely" related to the current unit.

(vi) Prepare state diagrams for primary classes.
Your Answer:

img

(vii) Write the skeleton code corresponding to the class diagram in C++, Java, Python, or C#.
Your Answer:

.
#include
.
.
using namespace std;
.
.
class commodity{
.
.
public:
.
.
string id;
.
.
string name;
.
.
int price;
.
.
string classification;
.
.
};
.
.
class order:public commodity{
.
.
public:
.
.
string order_id;
.
.
string data;
.
.
string user_id;
.
.
string com_id;
.
.
double com_price;
.
.
string sadto;
.
.
void cancel();
.
.
void modify();
.
.
void look();
.
.
virtual void buy();
.
.
virtual void salereturn();
.
.
};
.
.
#include "order.h"
.
.
class Merchant{
.
.
public:
.
.
string id;
.
.
string related_commodity;
.
.
string numer_commodity;
.
.
string related_live_room;
.
.
void offer_commodity();
.
.
void look_info();
.
.
void choose_anchor();
.
.
void deliver_goods() ;
.
.
};
.
.
class customer{
.
.
public:
.
.
string id;
.
.
string password:
.
.
int age;
.
.
int balance;
.
.
string address;
.
.
void login();
.
.
void modify_info();
.
.
void look_info();
.
.
void purchase();
.
.
void watch_the_live_broadcast();
.
.
void give_a_like();
.
.
void collect();
.
.
virtual void buy();
.
.
virtual void salereturn();
.
.
virtual void commit();
.
.
};
.
.
class live_online_room{
.
.
public:
.
.
string id;
.
.
string name;
.
.
string related_commodity;
.
.
commodity com;
.
.
void live streaming();
.
.
void choose_commodity();
.
.
void change_time();
.
.
void look_info();
.
.
virtual void commit();
.
.
private:
.
.
int balance;
.
.
int address;
.
.
};
.
.
class Platform_manager{
.
.
public:
.
.
string id;
.
.
string name;
.
.
void login_admin();
.
.
virtual void delete_commit();
.
.
};
.
.
.
.

请自己实现作业。请区分问题和作业!