Professional Documents
Culture Documents
Mars Report
Mars Report
J.N.T.U, Hyderabad)
Bachupally(v), Hyderabad, Telangana, India.
A course project submitted in complete requirements for the award of the degree of
BACHELOR OF TECHNOLOGY
IN
Submitted by
CERTIFICATE
VNRVJIET VNRVJIET
DECLARATION
I would like to express my gratitude and appreciation to all those who gave me
the possibility to complete this report. Special thanks is due to our Professor,
Mrs. Swapna Shetty whose help, stimulating suggestions and encouragement
helped us in all time of fabrication process and in writing this report. I also
sincerely thank for the time spent proofreading and correcting our mistakes.
VNRVJIET has helped us transform ourselves from mere amateurs in the field
of Computer Science into skilled engineers capable of handling any given
situation in real time. I am are highly indebted to the institute for everything
that it has given us.
We would like to express our gratitude towards the principal of our institute,
Dr. Challa Dhanunjaya Naidu and the Head of the Computer Science &
Engineering Department, Nagini Sabbineni for their kind co- operation and
encouragement which helped us complete the project in the stipulated time.
ABSTRACT
1. Introduction....................................................................................................7
2. Literature Survey...........................................................................................7
3. Requirements...................................................................................................8
4. Implementation................................................................................................9
5. Applications……………………………………………………14
6. Conclusion......................................................................................................14
1. Introduction
The stock market broadly refers to the collection of exchanges and other
venues where the buying, selling, and issuance of shares of publicly held
companies take place. This app allows investing funds from smartphone to
companies. Helps to become a shareholder of a company.
2. Literature Survey
A stock market, equity market, or share market is the aggregation of
buyers and sellers of stocks (also called shares), which represent ownership
claims on businesses; these may include securities listed on a public stock
exchange, as well as stock that is only traded privately, such as shares of
private companies which are sold to investors through equity crowdfunding
platforms. Investment in the stock market is most often done via
stockbrokerages and electronic trading platforms. Investment is usually made
with an investment strategy in mind.
A Stock market app allows Investing funds from smartphone to companies.
Helps to become a shareholder of a company. Some of the features of
application:
User account is a panel in application where users can enter their personal data,
adapt the application settings for themselves.
Balance and reporting panel display the real-time data about the user’s balance,
about the companies whose shares he or she owns, about the value of the
purchased assets, etc.
Tools for assets sale and purchase - Here you should provide for the display of
charts with the value of assets at a certain time interval, which are updated in
real time.
Anyone who have access to database can change the cost of items and add new
items in the database. Each and every user will have dedicated account for him,
in which he will have his application valet and stocks that he hold.
7
3. Requirements
XAMPP:
XAMPP is a free and open-source cross-platform web server solution stack
package developed by Apache Friends,[2] consisting mainly of the Apache
HTTP Server, MariaDB database, and interpreters for scripts written in the
PHP and Perl programming languages. Since most actual web server
deployments use the same components as XAMPP, it makes transitioning from
a local test server to a live server possible.
DEV CPP:
8
4.Code Snippets
Data base connection class:
class db{
const char* hostname="localhost";
const char* username="root";
const char* password="";
const char* database="mars";
unsigned int port =3306;
const char* unixsocket=NULL;
unsigned clientflag=0;
public:
MYSQL* connecteddatabase(){
MYSQL* conn;
conn = mysql_init(0);
conn =
mysql_real_connect(conn,hostname,username,password,database,port,unixsoc
ket,clientflag);
if(conn){
cout<<"Connected"<<" "<<conn<<endl;
system("pause");
return conn;
}
else{
cout<<"Not Connected"<<" "<<conn<<endl;
system("pause");
return conn;
}
}
};
Signup function:
void createuser(MYSQL* conn){
int qstate;
string s,p,cp,phno;
label:
stringstream ss,usercheck;
system("cls");
SetConsoleTextAttribute(h,2);
cout<<"Enter username: "<<endl;
SetConsoleTextAttribute(h,6);
cin>>s;
if(testusername(conn,s)){
cout<<"Username already exists! \nTry a different username"<<endl;
9
system("pause");
system("cls");
createuser(conn);
}
else{
SetConsoleTextAttribute(h,2);
cout<<"Enter Password: "<<endl;
SetConsoleTextAttribute(h,6);
cin>>p;
SetConsoleTextAttribute(h,2);
cout<<"Confirm Password: "<<endl;
SetConsoleTextAttribute(h,6);
cin>>cp;
SetConsoleTextAttribute(h,2);
cout<<"Phone number: "<<endl;
SetConsoleTextAttribute(h,6);
cin>>phno;
if(p==cp){
ss<<"INSERT INTO users(username,password,phno) VALUES
('"+s+"','"+p+"','"+phno+"')";
string query=ss.str();
const char* q=query.c_str();
qstate=mysql_query(conn,q);
if(qstate==0){
SetConsoleTextAttribute(h,12);
cout<<"Created!\nYou have received 100/- Welcome bonus"<<endl;
//user=s;
u.putuser(s);
//pass=p;
u.putpass(p);
stringstream ss1;
ss1<<"INSERT INTO
stocks(username,item1,item2,item3,item4,item5,item6,item7,item8,item9,item
10,password,balance) VALUES ('"+s+"',0,0,0,0,0,0,0,0,0,0,'"+p+"',100)";
string query=ss1.str();
const char* q=query.c_str();
mysql_query(conn,q);
system("pause");
// return true;
}
}
else{
cout<<"Passwords doesnt match!"<<endl;
system("pause");
10
goto label;
}
// return false;
}
}
Login function:
bool getuser(MYSQL* conn){
string user,pass;
system("cls");
SetConsoleTextAttribute(h,2);
cout<<"Type username:"<<endl;
SetConsoleTextAttribute(h,6);
cin>>user;
SetConsoleTextAttribute(h,2);
cout<<"Enter Password: "<<endl;
SetConsoleTextAttribute(h,6);
cin>>pass;
if(!checkup(conn,user,pass)){
cout<<"User name or password doesn't match!"<<endl;
system("pause");
return false;
}
u.putuser(user);
u.putpass(pass);
return true;
}
Invest function:
void invest(MYSQL* conn){
int c,n;
string user=u.getusern();
string pass=u.getpass();
cout<<"Stocks Available: "<<endl;
cout<<"-----------------"<<endl;
displaystocks(conn);
cout<<"User's Stocks: "<<endl;
cout<<"-------------"<<endl;
displayuserinfo(conn);
cout<<"Type on which item to invest: "<<endl;
cin>>c;
cout<<"Type quantity: "<<endl;
cin>>n;
stringstream ss;
ss<<"SELECT balance FROM stocks WHERE username='"+user+"' AND
11
password='"+pass+"' ";
string query=ss.str();
const char* q=query.c_str();
MYSQL_ROW row;
MYSQL_RES* res;
mysql_query(conn,q);
res=mysql_store_result(conn);
row=mysql_fetch_row(res);
int balance=atoi(row[0]);
stringstream ss1;
ss1<<"SELECT cost FROM cost WHERE itemname='item"+itos(c)+"' ";
query=ss1.str();
q=query.c_str();
// cout<<q<<endl;
mysql_query(conn,q);
res=mysql_store_result(conn);
row=mysql_fetch_row(res);
int cost=n*atoi(row[0]);
// cout<<row[0];
if(balance-cost>=0){
stringstream ss1;
int newbalance=balance-cost;
ss1<<"UPDATE stocks SET item"+itos(c)+"=item"+itos(c)+"+"+itos(n)
+", balance="+itos(newbalance)+" WHERE username='"+user+"' AND
password='"+pass+"' ";
string query=ss1.str();
q=query.c_str();
// cout<<q<<endl;
int querystatus=mysql_query(conn,q);
if(!querystatus){
cout<<"Transaction Successful!"<<endl;
system("pause");
system("cls");
}
}
else{
cout<<"Insufficient balance!"<<endl;
system("pause");
system("cls");
}
}
Deposit function:
12
void deposit(MYSQL* conn){
int i;
string user=u.getusern();
string pass=u.getpass();
cout<<"Type amount to be deposited: "<<endl;
cin>>i;
stringstream ss;
ss<<"SELECT balance FROM stocks WHERE username='"+user+"' AND
password='"+pass+"' ";
string query=ss.str();
const char* q=query.c_str();
MYSQL_ROW row;
MYSQL_RES* res;
mysql_query(conn,q);
res=mysql_store_result(conn);
row=mysql_fetch_row(res);
int newbalance=atoi(row[0])+i;
stringstream ss2;
ss2<<"UPDATE stocks SET balance="+itos(newbalance)+" WHERE
username='"+user+"' AND password='"+pass+"' ";
query=ss2.str();
q=query.c_str();
mysql_query(conn,q);
cout<<"Transaction Successful!"<<endl;
system("pause");
}
Display users shares function:
void displayuserinfo(MYSQL* conn){
stringstream ss;
string user=u.getusern();
string pass=u.getpass();
ss<<"SELECT
item1,item2,item3,item4,item5,item6,item7,item8,item9,item10,balance
FROM stocks WHERE username='"+user+"' AND password='"+pass+"' ";
string query=ss.str();
const char* q=query.c_str();
MYSQL_ROW row;
MYSQL_RES* res;
int qstate=mysql_query(conn,q);
if(!qstate){
res=mysql_store_result(conn);
row=mysql_fetch_row(res);
cout<<"Item\t\t\tNo.\n";
13
cout<<"----------------------------------------"<<endl;
for(int i=0;i<10;i++){
cout<<"item"<<i+1<<"\t:\t\t"<<row[i]<<endl;
}
cout<<"Balance: "<<row[10]<<endl;
cout<<"----------------------------------------\n"<<endl;
}
else{
cout<<"Error printing user stocks"<<endl;
}
}
14
5. MODEL IMPLEMENTATION
Home page:
15
Login page:
16
Signup page:
17
User’s page:
Invest:
18
Sell
Deposit
19
User A/C
6. Applications
Allows Investing funds from smartphone to companies.
Helps to become a shareholder of a company.
7. Conclusion
Our Stock market trading app helps users invest on some shares and become
shareholders. Investing in stocks are a way to build wealth. They are an
investment that means you own a share in the company that issued the stock.
Stocks are how ordinary people invest in some of the most successful companies
in the world.
-------X-------
20