SkillDevelopment (1)
SkillDevelopment (1)
LAB MANUAL
CS-606: Skill Development
This manual is intended for the Third Year students of Computer Science and
Engineering in the subject of Skill Development. This manual typically contains
practical/Lab Sessions related to the subject to enhance understanding.
The time spent on getting the design right before you start programming will
almost always save you time in the end. It's much, much easier to make major
changes on a design, which is after all just squiggly lines on paper, and then it is to
make changes in hundreds or thousands of lines of code.
The design process is typically split into distinct phases: Object Oriented Design
(OOD) and Design Pattern.
Students are advised to thoroughly go through this manual rather than only topics
mentioned in the syllabus as practical aspects are the key to understanding and
conceptual visualization of theoretical aspects covered in the books.
- Make entry in the Log Book as soon as you enter the Laboratory.
- All the students should sit according to their roll numbers starting from
their left to right.
- All the students are supposed to enter the terminal number in the log book.
- Do not change the terminal on which you are working.
- All the students are expected to get at least the algorithm of the
program/concept to be implemented.
- Strictly observe the instructions given by the teacher/Lab Instructor
Course Outcomes
List of Programs
S.No. Practical
1. Identifying the requirements from problem statements.
2. Estimation of Project Metrics
3. Modeling UML Use Case Diagrams and Capturing Use Case Scenarios
4. E-R Modeling from the Problem Statements
5. Modeling UML Class Diagrams and Sequence Diagrams
6.
Introduction to Design patterns. Describe the organization of catalog
along with the following design patterns.
a. Creational Patterns.
b. Structural Patterns.
c. Behavioral Patterns.
7.
Write a program to implement the following concepts in java.
a. Method overriding.
b. Interface.
c. Abstract class.
Experiment: 1
Identifying the Requirements from Problem Statements
Introduction
Requirement identification is the first and most important step in software development.
Before starting design, coding, or testing, it is necessary to understand what the client
needs. In our project, we are developing an ML-based price prediction system for an e-
commerce platform to forecast product prices based on demand, seasonality, and
competitor pricing. Clear and verified requirements help in building software that meets
user expectations.
In most cases, business analysts with domain knowledge discuss with clients to gather
requirements and define the necessary features of the system. Properly identified
requirements ensure smooth development and avoid confusion later in the project.
Requirements
Software requirements describe the features and functions of a system. They define what
the system should do and how it should behave. Requirements can be clear or hidden,
known or unknown, expected or unexpected from the client’s perspective.
The requirements for the ML-based price prediction system define the features and
functionalities necessary to accurately forecast product prices based on demand,
seasonality, and competitor pricing. These requirements ensure that the system meets user
expectations and provides accurate predictions for e-commerce businesses.
Characteristics of Requirements
For our ML-based price prediction system, the requirements must have the following
characteristics
Unambiguity: The system should provide clear and well-defined price predictions. For
example, if the system predicts price fluctuations, it should specify whether the price is
increasing or decreasing and by how much, avoiding vague outputs.
Consistency: The system must process data uniformly and avoid conflicting outputs. For
example, if two similar products with the same demand and seasonal trends are analyzed,
their predicted price range should be consistent.
Completeness: The system should cover all essential factors influencing price prediction,
such as historical demand, competitor pricing, seasonal trends, and product categories. It
should not leave out any critical variables that impact pricing decisions.
Categorization of Requirements
User Requirements
User requirements are written in simple terms to ensure e-commerce business owners and
stakeholders understand them clearly. These include:
• The system should allow users to input product details such as name, category, and
base price.
• Users should be able to view predicted prices based on demand and market trends.
• The system should generate reports and insights to help users make pricing
decisions.
System Requirements
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
System requirements are technical specifications meant for developers and testers to
ensure proper implementation. These include:
• The system should use machine learning algorithms to analyze demand, seasonality,
and competitor pricing.
• It should process large datasets efficiently and provide price predictions within a
specified time frame.
• The system must integrate with the e-commerce platform's database to fetch
relevant data for accurate forecasting.
Requirements can be classified into two groups based on what they describe
Functional Requirements (FRs)
Functional requirements define what the system should do. These are the core features and
functionalities necessary for the ML-based price prediction system.
Data Collection and Processing
The system should collect historical product pricing data from the e-commerce platform’s
database. It should fetch demand trends, seasonal variations, and competitor pricing
information from external sources. The system should process and clean raw data to
remove inconsistencies before analysis.
Machine Learning-Based Price Prediction
The system should implement machine learning models (such as regression models or
deep learning algorithms) to predict product prices. It should analyze past trends,
customer demand patterns, and seasonal fluctuations to generate accurate price forecasts.
Users should be able to input a product’s category, base price, and demand level, and the
system should return the predicted price.
User Interaction and Input Management
The system should provide a user-friendly dashboard for e-commerce sellers to input
product details. Users should be able to upload product lists in bulk (e.g., CSV or Excel files)
for price prediction. The system should allow manual adjustments to prediction
parameters based on specific business needs.
Prediction Output and Insights
The system should display predicted prices with confidence levels (e.g., 90% accuracy). It
should generate visual reports and graphs showing pricing trends over different time
periods. Users should receive recommendations on whether to increase, decrease, or
maintain the current price based on competitor trends and demand.
Integration with E-Commerce Platform
The system should be able to connect with the e-commerce platform’s API to automatically
fetch product data. It should provide an option to update product prices on the platform
based on prediction results. The system should support integration with popular e-
commerce platforms such as Amazon, Flipkart, or Shopify.
Non-Functional Requirements (NFRs)
Non-functional requirements define how the system should behave, ensuring performance,
security, scalability, and usability.
Performance Requirements
The system should process and return price predictions within 5 seconds for a single
product. It should handle bulk predictions (e.g., 10,000 products) within 1-2 minutes. The
system should ensure real-time updates when new demand or competitor data is available.
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
Scalability Requirements
The system should be able to handle large datasets, supporting thousands of products at a
time. It should dynamically scale based on the number of users accessing the system
simultaneously. Cloud-based infrastructure should be used to ensure high availability and
efficient resource allocation.
Accuracy and Reliability
The prediction model should maintain an accuracy rate of at least 90%, ensuring reliable
forecasts. The system should allow continuous training and updating of ML models to
improve accuracy over time. It should provide error margins for each prediction to help
users make informed decisions.
Security Requirements
The system should encrypt user and pricing data to prevent unauthorized access. It should
implement role-based access control (RBAC) to ensure that only authorized users can
modify price predictions. User authentication should be performed through secure login
mechanisms such as two-factor authentication (2FA).
Usability Requirements
The system should have an intuitive and easy-to-use interface for e-commerce sellers. It
should provide tooltips and explanations to help users understand prediction results. The
system should offer multi-language support for better accessibility in different regions.
Maintainability and Upgradability
The system should support regular updates to improve ML model performance. It should
be built with a modular architecture, allowing easy addition of new features. The system
should maintain logs of past predictions for future reference and analysis.
Preparing Software Requirements Specifications
A Software Requirements Specification (SRS) is a formal document that describes the
software system's functional and non-functional requirements in a structured manner. It
acts as a blueprint for software development and serves as a communication bridge
between clients, developers, and stakeholders.
Clear Understanding – It provides a detailed description of the system to be developed,
ensuring that all stakeholders have a shared understanding of the project.
Prevents Ambiguity – By documenting requirements clearly and unambiguously,
misunderstandings between clients and developers are minimized.
Legal Agreement – The SRS serves as a formal contract between the client and the
development team, preventing disputes regarding project scope.
Efficient Development – It guides developers, testers, and designers in building the
software according to predefined requirements.
Future Maintenance – The document acts as a reference for future updates,
enhancements, and debugging of the system.
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
SRS for ML-Based Price Prediction System
1. Introduction
1.1 Purpose
The purpose of this project is to develop an ML-based price prediction system for an e-
commerce platform. The system will forecast product prices based on demand trends,
seasonality, and competitor pricing to help sellers optimize their pricing strategies.
1.2 Scope
• The system will collect and process pricing data from e-commerce platforms and
competitors.
• It will use machine learning models to analyze trends and predict optimal prices.
• The platform will provide a user-friendly dashboard for sellers to input product
details, view predictions, and generate reports.
• The system will integrate with e-commerce APIs to update prices in real-time.
• It will ensure scalability, security, and performance optimization to handle large
datasets and multiple users.
1.3 References
• IEEE Standard for Software Requirements Specification (IEEE 830-1998)
• E-commerce market reports on pricing strategies
2. Overall Description
2.1 Product Perspective
• This system is independent but can integrate with existing e-commerce platforms.
• It will be deployed on cloud-based infrastructure for high availability and scalability.
• The system will use historical sales data, competitor pricing, and seasonal trends to
generate accurate price predictions.
2.2 Product Features
1. Automated Data Collection – Fetches pricing, demand, and competitor data from
multiple sources.
2. Price Prediction Model – Uses ML algorithms to suggest optimal pricing.
3. User Dashboard – Allows manual input, bulk uploads, and graphical reports.
4. Real-time Integration – Connects with e-commerce APIs to update prices
dynamically.
5. Security & Access Control – Ensures data encryption and user authentication.
2.3 User Characteristics
• E-commerce sellers and business owners looking for data-driven pricing strategies.
• Users with basic to advanced technical knowledge of pricing and analytics.
2.4 Constraints
• The system must process predictions within 5 seconds for a single product.
• It must support bulk uploads of up to 10,000 products.
• Data collection must comply with privacy regulations and not violate competitor
policies.
3. Specific Requirements
3.1 Functional Requirements
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
1. Data Processing: Collects and cleans pricing data.
2. Prediction Algorithm: Uses ML to forecast prices.
3. User Input: Allows manual and bulk data entry.
4. Output Reports: Provides graphs, insights, and recommendations.
5. Integration: Syncs with e-commerce platforms via APIs.
3.2 Non-Functional Requirements
1. Performance: Must handle large datasets efficiently.
2. Scalability: Supports increasing user load dynamically.
3. Security: Implements data encryption and user authentication.
4. Availability: The system must be accessible 24/7.
Examples:
A system may be required to suggest the most competitive price for a product
based on historical data and current market trends. This is a functional
requirement. How frequently these predictions should be updated (e.g., in
real-time or at scheduled intervals) is a non-functional requirement, as it
impacts system performance and responsiveness.
Description:
An ML-Based Price Prediction System helps e-commerce platforms forecast product
prices using machine learning algorithms by analyzing historical sales data, demand
trends, seasonal variations, and competitor pricing. This system enables businesses
to set optimal prices dynamically, maximizing profitability while maintaining
competitiveness.
The system continuously monitors and processes data, detecting market fluctuations
and adjusting pricing strategies accordingly. By leveraging advanced predictive models
such as regression analysis, time-series forecasting, and deep learning techniques,
it provides real-time insights and automated price adjustments.
Key Features:
Data Collection & Processing – Aggregates data from various sources, including competitor
websites, sales history, and customer behavior.
Dynamic Pricing Strategy – Adapts pricing based on market conditions, customer demand,
and stock availability.
User Dashboard & Analytics – Provides an intuitive interface with reports, graphs, and
real-time price recommendations.
Scalability & Performance – Handles large datasets efficiently and ensures quick price
updates.
Security & Compliance – Ensures data privacy and compliance with market regulations.
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
Experiment 2
Estimation of Project Metrics
Introduction
Project estimation is a crucial step in software development that helps in planning,
managing, and allocating resources efficiently. It involves estimating various software
metrics such as effort, cost, time, and size to ensure the successful execution of a project.
Without accurate estimation, projects may face delays, budget overruns, or resource
shortages.
In this experiment, we will focus on estimating project metrics for our ML-based price
prediction system for an e-commerce platform. The estimation process will help us
determine the effort required, development time, and resource allocation based on
different estimation techniques.
Project Estimation Techniques
Project estimation techniques are used to predict the key parameters that define the scope
and complexity of a project. These techniques provide insights into effort, cost, size, and
time estimation, ensuring better planning and risk management.
Important Parameters for Estimation
Some of the key parameters that should be estimated in a software project include-
Effort Estimation: Measures the amount of work required to complete the project.
Typically measured in Person-Months (PM) or Person-Hours (PH). Helps in determining
the number of developers needed.
Cost Estimation: Helps in budgeting and resource allocation. Includes costs for
development, testing, deployment, maintenance, and infrastructure.
Time Estimation: Predicts the total time required to develop the software. Helps in
defining project milestones and deadlines.
Size Estimation: Determines the amount of code or functionalities required. Measured in
Lines of Code (LOC) or Function Points (FP).
Complexity Estimation: Assesses the difficulty level of implementing the software.
Impacts the effort, cost, and time required.
Characteristics:
• Small-sized project (typically up to 50 KLOC).
• Well-understood problem and solution.
• Simple and stable development environment.
• Requires minimal innovation or research.
• The development team has good experience with similar projects.
Examples:
• Payroll management system.
• Basic inventory management system.
• Simple web applications.
Embedded Mode: Embedded projects are highly complex and critical systems that involve
strict requirements, real-time processing, and deep hardware/software integration. These
projects require extensive planning, documentation, and testing due to their critical nature.
Characteristics:
• Large-sized projects (above 300 KLOC).
• Complex and highly structured requirements.
• Requires strict documentation, validation, and verification.
• Often involves real-time constraints and deep integration with hardware.
• Typically developed for military, aviation, healthcare, or industrial automation.
Examples:
• Flight control systems.
• Real-time operating systems.
• Autonomous vehicle software.
• Space exploration systems.
Types of COCOMO Models: COCOMO (Constructive Cost Model) has three variations
based on the level of detail and complexity required for estimating software effort, cost, and
time. These are:
1. Basic COCOMO
2. Intermediate COCOMO
3. Detailed COCOMO
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
Basic COCOMO Model: The Basic COCOMO model provides an initial estimate of effort and
time based only on the number of lines of code (LOC) in the software. It does not consider
project complexity, developer experience, or tools.
Effort (PM) = a × (KLOC)^b
Time (T) = c × (Effort)^d
Where:
• PM (Person-Months) = Effort required
• T (Time in Months) = Estimated development time
• KLOC (Kilo Lines of Code) = Thousands of lines of source code
• a, b, c, d = Constants based on project type (Organic, Semi-Detached, Embedded)
Our ML-based price prediction system does not fit well with the Basic COCOMO model
because it does not account for data complexity, AI training, or integration requirements.
Basic COCOMO is too simplistic for estimating our project accurately.
Intermediate COCOMO Model: The Intermediate COCOMO model improves on the Basic
model by considering 15 cost drivers such as software complexity, developer experience,
tool availability, and reliability requirements.
Effort (PM) = a × (KLOC)^b × EAF
Time (T) = c × (Effort)^d
Where EAF (Effort Adjustment Factor) is based on 15 cost drivers, including-
• Product attributes (Complexity, reliability)
• Hardware attributes (Execution time, memory usage)
• Personnel attributes (Experience, team capability)
• Project attributes (Development tools, schedule constraints)
Project Types & Constants for Intermediate COCOMO
Project Type a b c d Example Projects
Organic 3.2 1.05 2.5 0.38 Small e-commerce websites, inventory systems
Semi- Our ML-based price prediction system,
3.0 1.12 2.5 0.35
Detached medium-size applications
Large-scale banking software, real-time AI
Embedded 2.8 1.20 2.5 0.32
models
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
Our project requires machine learning models, APIs, and database management, making it
moderately complex. The Intermediate COCOMO model is the best fit because it considers
developer expertise, tool availability, and AI-related complexities.
Detailed COCOMO Model: The Detailed COCOMO model extends the Intermediate model by
dividing the entire project into multiple components (subsystems/modules) and estimating each
part separately. It provides the most precise estimation but requires detailed breakdowns of
modules.
Uses the same Effort (PM) = a × (KLOC)^b × EAF, but applied to each module separately.
Factors in additional elements like design complexity, software reuse, and module
interdependence.
Detailed COCOMO Estimation Approach
Phase Effort Distribution (%) Time Distribution (%)
Planning & Requirements 6% 10%
System Design 16% 19%
Coding & Implementation 60% 38%
Testing & Debugging 18% 33%
Our ML-based project is not large enough to require a Detailed COCOMO model. If we split
the project into separate ML modules, APIs, frontend, and backend, then Detailed COCOMO
could be applied for better accuracy. However, Intermediate COCOMO is more practical for
our needs.
Halstead's Method
Halstead’s Software Metrics method, developed by Maurice Halstead, is used to measure
software complexity, size, and effort based on the number of operators and operands in the
source code. It helps in determining the project’s difficulty and effort required for
development.
Halstead's Metrics Formulae:
Experiment 3
Modeling UML Use Case Diagrams and Capturing Use
Case Scenarios
Introduction
A Use Case Diagram is a key component of Unified Modeling Language (UML) used to
visualize the functional requirements of a system. It helps in identifying how different users
(actors) interact with the system and what functionalities the system should provide.
For our project, which is an ML-based price prediction system for an e-commerce platform,
a Use Case Diagram will-
• Clearly define user interactions with the system.
• Help developers understand system requirements in a structured way.
• Identify relationships between various functionalities and users.
• Ensure all possible scenarios (normal and exceptional cases) are captured.
This diagram is useful for both technical and non-technical stakeholders, as it represents
the system in a simplified and visual format.
Use Case Diagrams
A Use Case Diagram represents the interactions between users (actors) and the system
functionalities (use cases). It shows, Who interacts with the system? (Actors), What
functionalities the system provides? (Use Cases) and How users interact with these
functionalities? (Relationships)
Components of a Use Case Diagram
Actor: An actor represents an external entity (user or system) that interacts with the
software system. Actors can be human users, external systems, or hardware devices that
perform actions in the system.
Classification of Actors: Actors are classified into two types-
Type Description Example in Our Project
Primary Directly interacts with the Admin, Seller, Buyer
Actor system
Secondary Supports or assists in the ML Model, Payment Gateway,
Actor background External API
Use Case: A Use Case represents a specific function or service that the system provides.
Each use case describes a user goal, such as predicting product prices, checking competitor
pricing, or placing an order.
System Boundary (Subject): The system boundary defines the scope of the system,
showing what functionalities are included. For our project, the system boundary represents
the ML-based price prediction system that interacts with buyers, sellers, and other external
entities.
Association (Relationships Between Actors and Use Cases): The association defines
the interaction between actors and use cases.
Common types of associations:
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
Direct Association (Simple Line): Represents direct interaction (e.g., Buyer → Predict
Price).
Include Relationship (<<include>> arrow): A use case includes another use case (e.g.,
“Predict Price” includes “Fetch Competitor Data”).
Extend Relationship (<<extend>> arrow): A use case extends another under certain
conditions (e.g., “Apply Discount” extends “Purchase Product” when a promotional offer is
available).
Use Case Relationships: In UML Use Case Diagrams, relationships define how different
use cases and actors interact within the system. These relationships help structure the
system in a logical way, ensuring clarity and maintainability.
Types of Use Case Relationships
Association (Simple Connection)
• Definition: Represents a direct interaction between an actor and a use case.
• Usage: Shows who can perform which function in the system.
• Notation: A solid line between an actor and a use case.
• Example in Our Project:
o Buyer → (Predict Product Price) → A buyer can use the price prediction
feature.
o Seller → (View Competitor Pricing) → A seller can check competitor prices.
Experiment 4
E-R Modeling from the Problem Statements
Introduction
A database is an organized collection of data that allows for efficient storage, retrieval, and
management. For any large-scale system, like an E-commerce platform, having a structured
database is crucial to handle information about buyers, sellers, products, pricing, demand,
and competitors.
Before implementing a database, it is important to visualize how different entities (such as
users, products, and transactions) interact with each other. The Entity-Relationship (E-R)
Model helps in designing a structured database by representing entities, attributes, and
relationships in a clear diagram.
By designing an E-R Model, we can: Identify key components of the system. Establish
relationships between different entities. Ensure data consistency and efficient querying.
Entity Relationship (E-R) Model
An entity relationship diagram (ERD) shows the relationships of entity sets stored in a
database. An entity in this context is an object, a component of data.
Entities – Objects or things that exist in the system (e.g., Buyer, Seller, Product).
Attributes – Characteristics of an entity (e.g., Product Name, Price, Demand Level).
Relationships – How entities interact with each other (e.g., Buyer purchases Product).
Below is the E-R diagram for our ML-Based Price Prediction System
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
Entities Defined:
• Buyer: Represents users who purchase products.
• Seller: Represents individuals or companies selling products.
• Product: Stores details of products available on the platform.
• Category: Defines product classification (e.g., Electronics, Clothing).
• CompetitorPricing: Stores competitor pricing data.
• ML_Model: Represents the machine learning model used for price prediction.
• Transaction: Records product purchases made by buyers.
Relationships & Associations:
• A Buyer makes a Transaction (Purchases a Product).
• A Product is part of a Transaction.
• A Seller lists a Product.
• A Product belongs to a Category.
• A Product has Competitor Pricing.
• The ML Model predicts the price of a Product.
Primary Key: A Primary Key (PK) is a unique identifier for each record in a table. It ensures
that no two records in a table have the same value for this column(s).
1. It must be unique for each row.
2. It cannot be NULL.
3. A table can have only one primary key.
Example
• In the Buyer table, Buyer_ID is the Primary Key because each buyer must have a
unique ID.
• In the Product table, Product_ID is the Primary Key as each product has a unique
identifier.
Buyer_ID (PK) Name Email Location
101 Ramesh [email protected] Indore
102 Sita [email protected] Bhopal
Candidate Key: A Candidate Key is a column or set of columns that can be a Primary Key.
It is a potential unique identifier for a table. Among multiple candidate keys, one is chosen
as the Primary Key, and the others are called Alternate Keys. Example
• In the Buyer table, both Buyer_ID and Email are unique.
o Buyer_ID (Chosen as Primary Key)
o Email (Candidate Key, since it is also unique)
Alternate Key: A Candidate Key that is not selected as the Primary Key is called an
Alternate Key. Example
• In the Product table, both Product_ID and Name (if unique) could be candidate keys.
• If we select Product_ID as the Primary Key, then Name (if unique) becomes an
Alternate Key.
Foreign Key: A Foreign Key (FK) is a column in one table that refers to the Primary Key of
another table. It helps in maintaining relationships between tables. Example
• In the Transaction table, Buyer_ID is a Foreign Key referencing Buyer_ID in the Buyer
table.
• In the Product table, Category_ID is a Foreign Key referencing Category_ID in the
Category table.
Transaction_ID (PK) Buyer_ID (FK) Product_ID (FK) Purchase_Date
201 101 301 2025-03-05
Super Key: A Super Key is a set of one or more attributes that can uniquely identify a row
in a table.
• A Super Key can contain extra attributes that are not needed for uniqueness.
• Every Primary Key is a Super Key, but not every Super Key is a Primary Key.
Example
• In the Buyer table, {Buyer_ID, Email, Name} is a Super Key, but {Buyer_ID} alone is
enough to uniquely identify records.
• {Product_ID, Name, Price} in the Product table is a Super Key, but {Product_ID} alone
can act as a Primary Key.
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
Composite Key: A Composite Key is formed when two or more columns together uniquely
identify a record, but individually, they may not be unique.Example
• In the Transaction table, Buyer_ID and Product_ID together form a Composite Key,
ensuring that a buyer can purchase the same product multiple times.
Unique Key:A Unique Key is like a Primary Key, but it allows NULL values. It ensures
that no two records have the same value in this column. Example
• In the Seller table, Business_Name should be Unique, as no two sellers should have
the same business name.
Mapping Cardinality: Mapping Cardinality defines the number of relationships that can
exist between two entities. It helps in designing the relationships between tables in the
database. There are four types of mapping cardinality-
One-to-One (1:1) Relationship: Each entity in one table is related to only one entity in
another table. Example- A Seller has only one associated Business Profile.
Seller_ID (PK) Name Business_Profile_ID (FK)
Ensures unique mapping between two tables. Used when entities have a direct dependency.
One-to-Many (1:M) Relationship: One entity in the first table is related to multiple
entities in the second table. Example- One Seller can have multiple Products.
Seller_ID (PK) Name Product_ID (PK) Product_Name Seller_ID (FK)
Many-to-One (M:1) Relationship: Many entities from the first table can be related to one
entity in the second table. Example- Many Buyers can place orders under one specific
Delivery_Agent.
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
Buyer_ID (PK) Name Delivery_Agent_ID (FK)
Useful for managing relationships with a centralized entity. Reduces data redundancy.
Many-to-Many (M:M) Relationship: Many entities in the first table can be related to many
entities in the second table. This relationship requires an intermediate (junction) table to
store the mapping. Example- A Buyer can purchase multiple Products, and a Product can
be bought by multiple Buyers.
Buyer_ID (PK) Name Product_ID (PK) Product_Name
101 Ravi 301 Laptop
102 Priya 302 Mobile
Primary Key (Oval with A unique attribute that identifies an entity (e.g.,
Attribute underline) Product_ID, Buyer_ID).
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
Multivalued An attribute that can have multiple values (e.g.,
(Double Oval)
Attribute Phone_Numbers of a Buyer).
An attribute derived from other attributes (e.g.,
Derived Attribute (Dashed Oval)
Age derived from Date_of_Birth).
Represents a relationship between entities (e.g.,
Relationship (Diamond)
Buys relationship between Buyer and Product).
A relationship where a weak entity depends on
Weak (Double
a strong entity (e.g., Contains relationship
Relationship Diamond)
between Order and Order_Item).
Each entity in the first table is related to only
One-to-One (1:1) (Entity) ◻️ ——
one entity in the second table (e.g., Seller has
Relationship ◻️ (Entity) one Business_Profile).
Experiment 5
Modeling UML Class Diagrams and Sequence Diagrams
Introduction
In software development, Unified Modeling Language (UML) diagrams play a crucial role
in designing and understanding a system before implementation. Among these, Class
Diagrams and Sequence Diagrams help in defining the static structure and dynamic
behaviour of a system.
Class Diagram represents the blueprint of a system by defining classes, attributes, methods,
and relationships among objects. Sequence Diagram illustrates the flow of interactions
between objects over time, showing how they communicate with each other.
For ML-based price prediction system, UML diagrams help in designing the system
structure and behaviour efficiently.
• The Class Diagram defines key entities like Product, Buyer, Seller, Order, and their
attributes, methods, and relationships.
• The Sequence Diagram models the interaction between components during price
prediction, data retrieval, and user transactions.
By creating these diagrams, we visualize system components, ensure correctness, reduce
design errors, and simplify development.
Structural and Behavioural Aspects
In UML modeling, a system is analyzed based on two main aspects-
Structural Aspects (Static View): The structural aspect defines the static components of
a system, including classes, objects, attributes, methods, and relationships. It remains
constant unless modified by developers. Components of Structural Aspects:
Class Diagram – Defines classes, attributes, methods, and relationships.
Object Diagram – Represents real-world instances of classes with their current values.
Component Diagram – Shows system components and their dependencies.
Deployment Diagram – Defines hardware and software deployment of the system.
For our price prediction system, structural aspects include:
Class Diagram: Defines entities like Product, Seller, Buyer, Order, and their relationships.
Component Diagram: Shows how ML model, database, and web application interact.
Deployment Diagram: Defines how our system is hosted (e.g., Cloud, Local Server).
Behavioural Aspects (Dynamic View): The behavioural aspect defines the dynamic
behaviour and interactions of system components. It focuses on how objects interact and
change over time. Components of Behavioural Aspects:
Sequence Diagram – Represents interactions between objects over time.
Activity Diagram – Describes workflow or business processes. State Machine Diagram –
Represents state transitions of an object.
Use Case Diagram – Defines user interactions with the system.
For our ML-based price prediction system, behavioural aspects include:
ACROPOLIS INSTITUTE OF TECHNOLOGY & RESEARCH, INDORE
DEPARTMENT OF COMPUTER SCIENCE ENGINEERING
Sequence Diagram: Models interactions like "Price Prediction Flow", where data is
fetched from the database, processed by the ML model, and displayed to the user.
Activity Diagram: Describes steps in "Product Price Analysis", where demand, seasonality,
and competitor prices are analyzed.
State Machine Diagram: Represents how a Product transitions between states like
"Listed", "In Demand", "Discounted", and "Out of Stock".
Class Diagram
A Class Diagram is a structural UML diagram that represents the static structure of a
system. It shows the classes, attributes, methods, and relationships between different
components of the system.
In our ML-based price prediction system, the class diagram helps in
• Defining the main entities involved in price prediction.
• Understanding relationships between various components like Product, Seller,
Buyer, Price Predictor, etc.
• Providing a clear blueprint for developers to implement the system efficiently.
Elements in a Class Diagram
A class diagram consists of the following elements:
Classes: A class is a blueprint that defines the properties and behaviors of objects. Each
class contains:
• Attributes (data members)
• Operations/Methods (functions that define behaviour)
Example
Class Name Attributes Operations (Methods)
product_id, name, category, price, calculatePrice(),
Product
demand_level, competitor_price getDetails()
addProduct(),
Seller seller_id, name, rating
updateProduct()
purchaseProduct(),
Buyer buyer_id, name, purchase_history
viewProduct()
predictPrice(),
PricePredictor algorithm_type, training_data
trainModel()
placeOrder(),
Order order_id, buyer_id, product_id, status
cancelOrder()
Sequence Diagram
A Sequence Diagram is a type of UML behavioral diagram that represents how objects
interact with each other over time. It depicts:
• Objects (instances of classes) involved in the system.
• Messages exchanged between objects in a specific order.
• The sequence of interactions to perform a particular operation.
For our ML-based price prediction system, the Sequence Diagram is useful in:
• Understanding how a user (buyer/seller) interacts with the system.
• Visualizing how the Price Predictor model processes data.
• Analyzing how different components like Product, Order, and Buyer interact.
Elements of a Sequence Diagram
A Sequence Diagram consists of several key elements:
Lifeline (Represents an Object): Definition: A lifeline represents a participant (object or
class) in the interaction. Represented by a vertical dashed line. Example in Our Project:
Buyer, Seller, Product, PricePredictor, and Order have lifelines.
|-----------------------------------------------|--------------------------------------------------| (Lifelines)
Below is the Sequence Diagram for a Buyer purchasing a Product and using the Price
Prediction system.