Sie sind auf Seite 1von 6

Python DB Integration Project

Python Database Integration Project


Easy Shop Retail Application
Team size: 3 Max Mark: 50

Instructions to Candidates:

1. Follow the class diagram strictly. Read the problem statement, functionality and the other
details provided carefully and implement the solution
2. Ensure that all the constructors are public and DO NOT change the prototype of the
constructor and the methods
3. Code submitted with compilation errors may not get evaluated
4. The coding standards are mandatory wherever applicable

Guidelines:

1. This assessment is intended to test the hands on skills related to Programming and Database
Connectivity using Python
2. You must use Eclipse, cx_Oracle and Oracle 11g Express Edition for implementing

NOTE: NOT adhering to the above instructions and guidelines may lead to drastic reduction in your score
even if the code is executing without any errors

Few errors which might result in mark reduction:

1. Infinite loops/infinite recursive calls in the code


2. Class diagram violation
3. Improper constructor prototype or definition

WISH YOU ALL THE BEST


Problem Description:
Easy Shop Retail Application:
Easy shop wants to automate their customer details in system. The automation involves in maintenance
of customers informations. Customers can be regular or privileged customers. Customers who are regular
visitors to the store are eligible for discount on the bill amount. The privileged customers are given
membership cards (Platinum, Gold and Silver) along with 10% discount on all products. Such customers
are eligible for gifts based on the type of membership card. Customers address are maintained for free
home delivery of the products.
Python DB Integration Project

Write a Python program to implement the class diagrams below.

Class Diagram

Database: Implement the above class diagram and connect it with database tables to maintain customer
details. Validate the customer details and Demo (Main class) must have the option to select for
manipulating with database like insert/modify/delete/search.

Table Structure:

Address:

Sl.no Column Name Type Size Description


1 addressId Number 4 Primary key eg: 1
2 addressLine Varchar 30
3 City Varchar 20
4 Zip Number 6
5 State Varchar 20
6 customerId Char 5 Foreign Key - References CustomerId of
Customer table

Customer:

Sl.no Column Name Type Size Description


Python DB Integration Project

1 customerId Char 5 Primary key eg: C001


2 customerName Varchar 20 Apply NOT NULL Constraint
3 telephoneNo Number 12 Apply NOT NULL Constraint
5 totalBillingAmount Number 10,2 Apply NOT NULL Constraint
6 customerType Varchar 20 Either Regular or Privileged
7 Discount Number 7,2 Either 5% or 7% or 10%.
8 memCardType Varchar 10 Either 'Platinum' or 'Gold' or 'Silver'.
Membership Card is applicable only for
Privileged Customer and default discount
for all Privileged Customer is 10%

Note:

1. Use case insensitive String comparison wherever applicable.


2. Perform case sensitive character comparison wherever applicable.
3. Do not include any extra instance variables or member methods in the given classes.
4. Do typecasting wherever appropriate
5. The order of passing the values to the child class constructor would be member variables of parent
class followed by the child class
6. Implement Getter and Setter methods for all the variables

Implementation Details:
Class: Customer

Add code to Customer based on the class diagram and the additional implementation details are given
below.

Constructor

It initializes customerid, customername, telephoneno, totalbillingamount, customertype and


auto generates customerid.
customerid should an string value prefix with C followed by integer value starting from 001. For
example first customerid would be C001; the second would be C002 etc.

validatetelephoneno()

This method validates the telephoneno member variable and returns a boolean value
telephoneno must be validated for 12 digits (including country code eg: 91) and also the first 2
digits must match with our country code (91).
This method returns true if the value of telephoneno is valid, otherwise it must return false
Python DB Integration Project

calculateCustomerType()

Column Name Minimum Range Maximum Range Customer Type


TotalBillingAmount >=0 <25000 Regular
TotalBillingAmount >=25000 - Privileged

Class: Regular Customer

Add code to Regular Customer based on the class diagram and use Customer as parent class. Additional
implementation details are given below.

Constructor

It initializes the base class variables like customerid, customername, telephoneno,


totalbillingamount, customertype, discount.

calculateDiscount()

Column Name Minimum Range Maximum Range Customer Discount


TotalBillingAmount >=0 <15000 5%
TotalBillingAmount >=15000 <20000 7%
TotalBillingAmount >=20000 - 10%

displayCustomerInformations()

Prints all the details of the Customer

Class: Privileged Customer

Add code to Privileged Customer based on the class diagram and use Customer as parent class. Additional
implementation details are given below.

Constructor

It initializes the base class variables like customerid, customername, telephoneno,


totalbillingamount, customertype, memcardtype.
Python DB Integration Project

calculateMemberCardType()

Column Name Minimum Range Maximum Range Customer MemberCard Type


TotalBillingAmount >=25000 <50000 Silver
TotalBillingAmount >=50000 <75000 Gold
TotalBillingAmount >=75000 - Platinum

displayCustomerInformations()

Prints all the details of the Customer and Address details must be printed, if the customer
need the products to be home delivered.

Class: Address

Add code to Address based on the class diagram. Wherever needed, the additional implementation details
are given below.

Constructor:

Use parameterized constructor to initialize addressline, city, zipcode and state. Auto-generated
number must be given for addressid.

validatezipcode ():

This method validates the zipcode member variable and returns a boolean value
zipcode must be validated for 6 digits
This method returns true if the value of zipcode is valid, otherwise it must return false

Demo Class:

Demo class is the starter class


Code for the Demo class is provided to you
Read and understand the functionality of the code
You can modify the code of Demo class for testing purpose but ensure that you are submitting it
compilation error free
Demo class will not be evaluated
Demo class will have the option to insert/modify/delete/search customer details
Python DB Integration Project

Sample Output Expected:


*********************************************************************************
Easy Shop Retail Application
*********************************************************************************
1. Add New Customer
2. Modify Total Billing Amount
3. View all Customers
4. View all Regular Customers
5. View all Privileged Customers
6. Exit
&=&=&=&=&=&=&

Marks Distribution [50 Marks]:

1. Implementation of Address class : 10 Marks


1. Declaration of instance variables : 2 marks
2. Constructor : 2 mark
3. Getter & Setter methods : 2 mark
4. Validate methods : 4 marks

2. Table Creation in Database : 10 Marks

3. Implementation of Customer class : 10 Marks


1. Declaration of instance variables : 2 marks
2. Constructor : 2 mark
3. Getter & Setter methods : 2 mark
4. Validate methods : 4 marks

4. Implementation of Demo class : 10 Marks


1. Add Method : 2 marks
2. Modify Methods : 4 marks
3. View all ID Method : 2 marks
4. View by Customer Type Method : 2 marks

5. Coding Standard and Naming Convention : 10 Marks

Das könnte Ihnen auch gefallen