@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
EX NO :6 DATE : 27-8-2014 
STOCK APPLICATION USING CORBA 
NAME : M.F.JERINCE RAJA ROLLNO : 12LMC004 
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 
STOCK.IDL 
********* 
module stck_market 
{ 
interface stock 
{ 
const unsigned short SIZE = 20; 
typedef string name[SIZE]; 
typedef short id[6]; 
typedef short amount[10]; 
typedef long shares[SIZE]; 
typedef string addr[SIZE]; 
long buyshare(in long amt,in long share); 
long sellshare(in long amt,in long share); 
}; 
}; 
STOCKIMPL 
********** 
import stck_market.*; 
import org.omg.CORBA.*; 
class stckimpl extends stockPOA 
{ 
private ORB orb; 
public stckimpl(ORB orb) 
{ 
this.orb = orb; 
} 
public int buyshare(int amt,int share) 
{ 
return(amt*share); 
} 
public int sellshare(int amt,int share) 
{ 
return(amt*share); 
} 
} 
SERVER 
****** 
import stck_market.*; 
import org.omg.CORBA.*; 
import org.omg.CosNaming.*; 
import org.omg.PortableServer.*; 
import org.omg.PortableServer.POA; 
import org.omg.CosNaming.NamingContextPackage.*; 
public class server 
{ 
public static void main(String args[])
{ 
try 
{ 
ORB orb = ORB.init(args, null); 
stckimpl imp_obj = new stckimpl(orb); 
POA rootpoa = 
POAHelper.narrow(orb.resolve_initial_references("RootPOA")); 
rootpoa.the_POAManager().activate(); 
org.omg.CORBA.Object ref = 
rootpoa.servant_to_reference(imp_obj); 
stock href = stockHelper.narrow(ref); 
org.omg.CORBA.Object objRef = 
orb.resolve_initial_references("NameService"); 
NamingContextExt ncRef = 
NamingContextExtHelper.narrow(objRef); 
String name = "stock"; 
NameComponent path[] = ncRef.to_name( name ); 
ncRef.rebind(path, href); 
System.out.println(" Server ready... "); 
orb.run(); 
} 
catch (Exception e) 
{ 
System.err.println("ERROR: " + e); 
e.printStackTrace(System.out); 
} 
System.out.println("Server Exiting ...."); 
} 
} 
CLIENT 
******* 
import stck_market.*; 
import org.omg.CORBA.*; 
import org.omg.CosNaming.*; 
import org.omg.CosNaming.NamingContextPackage.*; 
import java.io.*; 
public class client 
{ 
public static void main(String args[]) 
{ 
try 
{ 
int cmid = 0, csid = 0, repeat = 1,n; 
int comp_id[] = new int[6]; 
String comp_name[] = new String[stck_market.stock.SIZE]; 
int shr[] = new int[stck_market.stock.SIZE]; 
int shr_pri[] = new int[stck_market.stock.SIZE]; 
String comp_addr[] = new String[stck_market.stock.SIZE]; 
int amt[] = new int[stck_market.stock.SIZE];
int cust_id[] = new int[6]; 
String cust_name[] = new String[stck_market.stock.SIZE]; 
int cust_shr[] = new int[stck_market.stock.SIZE]; 
String cust_addr[] = new String[stck_market.stock.SIZE]; 
int cust_amt[] = new int[stck_market.stock.SIZE]; 
int ctshr_pri[] = new int[stck_market.stock.SIZE]; 
BufferedReader br = new BufferedReader(new 
InputStreamReader(System.in)); 
ORB orb = ORB.init(args, null); 
org.omg.CORBA.Object objRef = 
orb.resolve_initial_references("NameService"); 
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); 
String name = "stock"; 
stock obj = stockHelper.narrow(ncRef.resolve_str(name)); 
System.out.println("Handle obtained on server object: "+obj); 
System.out.println(" CORBA APPLICATION FOR STOCK MARKET "); 
System.out.println(" ~~~~~ ~~~~~~~~~~~ ~~~ ~~~~~ ~~~~~~ "); 
System.out.println(" Enter the number of company & customer to be 
registered : "); 
n = Integer.parseInt(br.readLine()); 
for(int i=0;i<n;i++) 
{ 
System.out.println("tt Company Registration "); 
System.out.println(" Enter the company ID : "); 
comp_id[i] = Integer.parseInt(br.readLine()); 
System.out.println(" Enter the company name : "); 
comp_name[i] = br.readLine(); 
System.out.println(" Enter the company address : "); 
comp_addr[i] = br.readLine(); 
System.out.println(" Enter the company shares : "); 
shr[i] = Integer.parseInt(br.readLine()); 
System.out.println(" Enter the unit prize of shares : "); 
shr_pri[i] = Integer.parseInt(br.readLine()); 
System.out.println(" Enter the total amount of shares owned : 
"); 
amt[i] = Integer.parseInt(br.readLine()); 
System.out.println("tt Customer Registration "); 
System.out.println(" Enter the customer ID : "); 
cust_id[i] = Integer.parseInt(br.readLine()); 
System.out.println(" Enter the customer name : "); 
cust_name[i] = br.readLine(); 
System.out.println(" Enter the customer address : "); 
cust_addr[i] = br.readLine(); 
System.out.println(" Enter the number of shares owned : "); 
cust_shr[i] = Integer.parseInt(br.readLine()); 
System.out.println(" Enter the unit prize of shares : "); 
ctshr_pri[i] = Integer.parseInt(br.readLine()); 
System.out.println(" Enter the total amount of shares owned : 
"); 
cust_amt[i] = Integer.parseInt(br.readLine()); 
} 
do 
{ 
System.out.println(" 1 - > BUY SHARES 2 - > SELL SHARES 3 - > LIST 
THE DETAILS "); 
System.out.println(" Enter the choice : "); 
int ch = Integer.parseInt(br.readLine()); 
switch(ch) 
{ 
case 1: 
System.out.println("t BUY SHARES "); 
System.out.println(" Enter the company ID : "); 
cmid = Integer.parseInt(br.readLine());
System.out.println(" Enter the customer ID : "); 
csid = Integer.parseInt(br.readLine()); 
for(int i=0;i<n;i++) 
{ 
if(cmid==comp_id[i] && csid==cust_id[i]) 
{ 
System.out.println(" Enter the number of shares to buy : "); 
int share = Integer.parseInt(br.readLine()); 
int unit_price = shr_pri[i]; 
int cur_amt = obj.buyshare(unit_price,share); 
System.out.println(" Shares bought : "+share); 
System.out.println(" Total amount : "+cur_amt); 
shr[i] = shr[i] - share; 
amt[i] = amt[i] - cur_amt; 
cust_shr[i] = cust_shr[i] + share; 
cust_amt[i] = cust_amt[i] + cur_amt; 
break; 
}} 
break; 
case 2: 
System.out.println("t SELL SHARES "); 
System.out.println(" Enter the company ID : "); 
cmid = Integer.parseInt(br.readLine()); 
System.out.println(" Enter the customer ID : "); 
csid = Integer.parseInt(br.readLine()); 
for(int i=0;i<n;i++) 
{ 
if(cmid==comp_id[i] && csid==cust_id[i]) 
{ 
System.out.println(" Enter the number of shares to sell : "); 
int share = Integer.parseInt(br.readLine()); 
int unit_price = ctshr_pri[i]; 
int cur_amt = obj.sellshare(unit_price,share); 
System.out.println(" Shares sold : "+share); 
System.out.println(" Total amount : "+cur_amt); 
shr[i] = shr[i] + share; 
amt[i] = amt[i] + cur_amt; 
cust_shr[i] = cust_shr[i] - share; 
cust_amt[i] = cust_amt[i] - cur_amt; 
break; 
} 
} 
break; 
case 3: 
for(int i=0;i<n;i++) 
{ 
System.out.println("ttt Company Details "); 
System.out.println("t Company ID : "+comp_id[i]); 
System.out.println("t Company name : "+comp_name[i]); 
System.out.println("t Company Shares : "+shr[i]); 
System.out.println("t Total Amount of Shares Owned : "+amt[i]); 
System.out.println("ttt Customer Details "); 
System.out.println("t Customer ID : "+cust_id[i]); 
System.out.println("t Customer Name : "+cust_name[i]); 
System.out.println("t Total Number of Shares Owned : "+cust_shr[i]); 
System.out.println("t Total Amount of Shares Owned : "+cust_amt[i]);
} 
break; 
} 
System.out.println(" Press 1 to continue... "); 
repeat = Integer.parseInt(br.readLine()); 
}while(repeat==1); 
} 
catch (Exception e1) 
{ 
System.out.println("ERROR : " + e1) ; 
e1.printStackTrace(System.out); 
} 
} 
} 
OUTPUT 
****** 
Z:st>idlj -fall stock.idl 
Z:st>javac *.java 
Note: .stck_marketstockPOA.java uses unchecked or unsafe operations. 
Note: Recompile with -Xlint:unchecked for details. 
Z:st>javac *.java stck_market/*.java 
Note: stck_marketstockPOA.java uses unchecked or unsafe operations. 
Note: Recompile with -Xlint:unchecked for details. 
Z:st>orbd -ORBInitialPort 2500 
Z:st>java server -ORBInitialPort 2500 
Server ready... 
CORBA APPLICATION FOR STOCK MARKET 
~~~~~ ~~~~~~~~~~~ ~~~ ~~~~~ ~~~~~~ 
Enter the number of company & customer to be registered : 
1 
Company Registration 
Enter the company ID : 
1234 
Enter the company name : 
cicso 
Enter the company address : 
northstreet 
Enter the company shares : 
100 
Enter the unit priCe of shares : 
50 
Enter the total amount of shares owned : 
80 
Customer Registration 
Enter the customer ID : 
101 
Enter the customer name : 
RAJA 
Enter the customer address : 
M.G,.R nagar 
Enter the number of shares owned : 
40 
Enter the unit prize of shares :
40 
Enter the total amount of shares owned : 
10 
1 - > BUY SHARES 2 - > SELL SHARES 3 - > LIST THE DETAILS 
Enter the choice : 
1 
BUY SHARES 
Enter the company ID : 
1234 
Enter the customer ID : 
101 
Enter the number of shares to buy : 
15 
Shares bought : 15 
Total amount : 750 
Press 1 to continue...
40 
Enter the total amount of shares owned : 
10 
1 - > BUY SHARES 2 - > SELL SHARES 3 - > LIST THE DETAILS 
Enter the choice : 
1 
BUY SHARES 
Enter the company ID : 
1234 
Enter the customer ID : 
101 
Enter the number of shares to buy : 
15 
Shares bought : 15 
Total amount : 750 
Press 1 to continue...

More Related Content

DOCX
Add invoice
PPT
PDF
The Art of Clean Code
DOCX
Sql
PDF
Clean Coders Hate What Happens To Your Code When You Use These Enterprise Pro...
PDF
C++ L07-Struct
TXT
c++ program for Railway reservation
PDF
Serverless Functions and Vue.js
Add invoice
The Art of Clean Code
Sql
Clean Coders Hate What Happens To Your Code When You Use These Enterprise Pro...
C++ L07-Struct
c++ program for Railway reservation
Serverless Functions and Vue.js

Viewers also liked (19)

DOC
HR QUESTIONS
PPT
1.Introduction
PPT
13.IO systems
PPT
4.Threads
PPT
12.mass stroage system
PPT
7.Dead Locks
PPT
XML Programming WML by Dickson K.W. Chiu PhD, SMIEEE
PPT
2.Operating System Structures
PPT
3.Process Management
DOC
RSA alogrithm
PPT
Introduction to Mobile Application Development
PPT
WML Script by Shanti katta
PPT
Introduction to wireless application protocol (wap)ogi
PPT
6.Process Synchronization
PPT
11.file system implementation
PPT
Markup Languages
PPT
Wireless Application Protocol WAP by Alvinen
PPT
What is WAP?
PPT
Wireless Communication and Networking by WilliamStallings Chap2
HR QUESTIONS
1.Introduction
13.IO systems
4.Threads
12.mass stroage system
7.Dead Locks
XML Programming WML by Dickson K.W. Chiu PhD, SMIEEE
2.Operating System Structures
3.Process Management
RSA alogrithm
Introduction to Mobile Application Development
WML Script by Shanti katta
Introduction to wireless application protocol (wap)ogi
6.Process Synchronization
11.file system implementation
Markup Languages
Wireless Application Protocol WAP by Alvinen
What is WAP?
Wireless Communication and Networking by WilliamStallings Chap2
Ad

Similar to STOCK APPLICATION USING CORBA (14)

DOCX
--Book-java package bookStore- public class Book extends Product { (1).docx
PDF
You are to write a GUI program that will allow a user to buy, sell a.pdf
PDF
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdf
PDF
import java.util.Random;defines the Stock class public class S.pdf
PDF
Java Programming Projects
PDF
Companies and people often buy and sell stocks. Often they buy the sa.pdf
PDF
This is a java lab assignment. I have added the first part java re.pdf
PPTX
stock.pptx
DOCX
VISUALIZAR REGISTROS EN UN JTABLE
PDF
operating system ubuntu,Linux,Macpublic class SuperMarket {   .pdf
PDF
database propertiesjdbc.url=jdbcderbyBigJavaDB;create=true # .pdf
DOC
Java codes output preliminary level
DOCX
Automate 2
PDF
help me Java projectI put problem and my own code in the linkmy .pdf
--Book-java package bookStore- public class Book extends Product { (1).docx
You are to write a GUI program that will allow a user to buy, sell a.pdf
JAVA...With N.E.T_B.E.A.N.S___________________________________.pdf
import java.util.Random;defines the Stock class public class S.pdf
Java Programming Projects
Companies and people often buy and sell stocks. Often they buy the sa.pdf
This is a java lab assignment. I have added the first part java re.pdf
stock.pptx
VISUALIZAR REGISTROS EN UN JTABLE
operating system ubuntu,Linux,Macpublic class SuperMarket {   .pdf
database propertiesjdbc.url=jdbcderbyBigJavaDB;create=true # .pdf
Java codes output preliminary level
Automate 2
help me Java projectI put problem and my own code in the linkmy .pdf
Ad

More from Senthil Kanth (14)

PPT
wireless communication and networking Chapter 1
PPT
WAP- Wireless Application Protocol
PPT
MOBILE APPs DEVELOPMENT PLATFORMS
DOC
HR QUESTIONS, INTERVIEW QUESTIONS
PDF
Zone Routing Protocol (ZRP)
PDF
On-Demand Multicast Routing Protocol
ODP
Adhoc routing protocols
PDF
DSDV VS AODV
PPT
16.Distributed System Structure
PPT
15.Security
PPT
14.Protection
PPT
10.file system interface
PPT
9.Virtual Memory
PPT
5.CPU Scheduling
wireless communication and networking Chapter 1
WAP- Wireless Application Protocol
MOBILE APPs DEVELOPMENT PLATFORMS
HR QUESTIONS, INTERVIEW QUESTIONS
Zone Routing Protocol (ZRP)
On-Demand Multicast Routing Protocol
Adhoc routing protocols
DSDV VS AODV
16.Distributed System Structure
15.Security
14.Protection
10.file system interface
9.Virtual Memory
5.CPU Scheduling

Recently uploaded (20)

PDF
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
PDF
English Textual Question & Ans (12th Class).pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
PPTX
Core Concepts of Personalized Learning and Virtual Learning Environments
PPTX
Computer Architecture Input Output Memory.pptx
PPTX
Share_Module_2_Power_conflict_and_negotiation.pptx
PDF
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
PDF
semiconductor packaging in vlsi design fab
PPTX
DRUGS USED FOR HORMONAL DISORDER, SUPPLIMENTATION, CONTRACEPTION, & MEDICAL T...
PPTX
A powerpoint presentation on the Revised K-10 Science Shaping Paper
PDF
Climate and Adaptation MCQs class 7 from chatgpt
PDF
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
PDF
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
PDF
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
PDF
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
PPTX
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
PDF
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
PDF
FORM 1 BIOLOGY MIND MAPS and their schemes
PPTX
Introduction to pro and eukaryotes and differences.pptx
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
LIFE & LIVING TRILOGY - PART - (2) THE PURPOSE OF LIFE.pdf
English Textual Question & Ans (12th Class).pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 1)
Core Concepts of Personalized Learning and Virtual Learning Environments
Computer Architecture Input Output Memory.pptx
Share_Module_2_Power_conflict_and_negotiation.pptx
Τίμαιος είναι φιλοσοφικός διάλογος του Πλάτωνα
semiconductor packaging in vlsi design fab
DRUGS USED FOR HORMONAL DISORDER, SUPPLIMENTATION, CONTRACEPTION, & MEDICAL T...
A powerpoint presentation on the Revised K-10 Science Shaping Paper
Climate and Adaptation MCQs class 7 from chatgpt
BP 505 T. PHARMACEUTICAL JURISPRUDENCE (UNIT 2).pdf
BP 704 T. NOVEL DRUG DELIVERY SYSTEMS (UNIT 2).pdf
MBA _Common_ 2nd year Syllabus _2021-22_.pdf
1.3 FINAL REVISED K-10 PE and Health CG 2023 Grades 4-10 (1).pdf
ELIAS-SEZIURE AND EPilepsy semmioan session.pptx
FOISHS ANNUAL IMPLEMENTATION PLAN 2025.pdf
FORM 1 BIOLOGY MIND MAPS and their schemes
Introduction to pro and eukaryotes and differences.pptx
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf

STOCK APPLICATION USING CORBA

  • 1. @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ EX NO :6 DATE : 27-8-2014 STOCK APPLICATION USING CORBA NAME : M.F.JERINCE RAJA ROLLNO : 12LMC004 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ STOCK.IDL ********* module stck_market { interface stock { const unsigned short SIZE = 20; typedef string name[SIZE]; typedef short id[6]; typedef short amount[10]; typedef long shares[SIZE]; typedef string addr[SIZE]; long buyshare(in long amt,in long share); long sellshare(in long amt,in long share); }; }; STOCKIMPL ********** import stck_market.*; import org.omg.CORBA.*; class stckimpl extends stockPOA { private ORB orb; public stckimpl(ORB orb) { this.orb = orb; } public int buyshare(int amt,int share) { return(amt*share); } public int sellshare(int amt,int share) { return(amt*share); } } SERVER ****** import stck_market.*; import org.omg.CORBA.*; import org.omg.CosNaming.*; import org.omg.PortableServer.*; import org.omg.PortableServer.POA; import org.omg.CosNaming.NamingContextPackage.*; public class server { public static void main(String args[])
  • 2. { try { ORB orb = ORB.init(args, null); stckimpl imp_obj = new stckimpl(orb); POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA")); rootpoa.the_POAManager().activate(); org.omg.CORBA.Object ref = rootpoa.servant_to_reference(imp_obj); stock href = stockHelper.narrow(ref); org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); String name = "stock"; NameComponent path[] = ncRef.to_name( name ); ncRef.rebind(path, href); System.out.println(" Server ready... "); orb.run(); } catch (Exception e) { System.err.println("ERROR: " + e); e.printStackTrace(System.out); } System.out.println("Server Exiting ...."); } } CLIENT ******* import stck_market.*; import org.omg.CORBA.*; import org.omg.CosNaming.*; import org.omg.CosNaming.NamingContextPackage.*; import java.io.*; public class client { public static void main(String args[]) { try { int cmid = 0, csid = 0, repeat = 1,n; int comp_id[] = new int[6]; String comp_name[] = new String[stck_market.stock.SIZE]; int shr[] = new int[stck_market.stock.SIZE]; int shr_pri[] = new int[stck_market.stock.SIZE]; String comp_addr[] = new String[stck_market.stock.SIZE]; int amt[] = new int[stck_market.stock.SIZE];
  • 3. int cust_id[] = new int[6]; String cust_name[] = new String[stck_market.stock.SIZE]; int cust_shr[] = new int[stck_market.stock.SIZE]; String cust_addr[] = new String[stck_market.stock.SIZE]; int cust_amt[] = new int[stck_market.stock.SIZE]; int ctshr_pri[] = new int[stck_market.stock.SIZE]; BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); ORB orb = ORB.init(args, null); org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService"); NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef); String name = "stock"; stock obj = stockHelper.narrow(ncRef.resolve_str(name)); System.out.println("Handle obtained on server object: "+obj); System.out.println(" CORBA APPLICATION FOR STOCK MARKET "); System.out.println(" ~~~~~ ~~~~~~~~~~~ ~~~ ~~~~~ ~~~~~~ "); System.out.println(" Enter the number of company & customer to be registered : "); n = Integer.parseInt(br.readLine()); for(int i=0;i<n;i++) { System.out.println("tt Company Registration "); System.out.println(" Enter the company ID : "); comp_id[i] = Integer.parseInt(br.readLine()); System.out.println(" Enter the company name : "); comp_name[i] = br.readLine(); System.out.println(" Enter the company address : "); comp_addr[i] = br.readLine(); System.out.println(" Enter the company shares : "); shr[i] = Integer.parseInt(br.readLine()); System.out.println(" Enter the unit prize of shares : "); shr_pri[i] = Integer.parseInt(br.readLine()); System.out.println(" Enter the total amount of shares owned : "); amt[i] = Integer.parseInt(br.readLine()); System.out.println("tt Customer Registration "); System.out.println(" Enter the customer ID : "); cust_id[i] = Integer.parseInt(br.readLine()); System.out.println(" Enter the customer name : "); cust_name[i] = br.readLine(); System.out.println(" Enter the customer address : "); cust_addr[i] = br.readLine(); System.out.println(" Enter the number of shares owned : "); cust_shr[i] = Integer.parseInt(br.readLine()); System.out.println(" Enter the unit prize of shares : "); ctshr_pri[i] = Integer.parseInt(br.readLine()); System.out.println(" Enter the total amount of shares owned : "); cust_amt[i] = Integer.parseInt(br.readLine()); } do { System.out.println(" 1 - > BUY SHARES 2 - > SELL SHARES 3 - > LIST THE DETAILS "); System.out.println(" Enter the choice : "); int ch = Integer.parseInt(br.readLine()); switch(ch) { case 1: System.out.println("t BUY SHARES "); System.out.println(" Enter the company ID : "); cmid = Integer.parseInt(br.readLine());
  • 4. System.out.println(" Enter the customer ID : "); csid = Integer.parseInt(br.readLine()); for(int i=0;i<n;i++) { if(cmid==comp_id[i] && csid==cust_id[i]) { System.out.println(" Enter the number of shares to buy : "); int share = Integer.parseInt(br.readLine()); int unit_price = shr_pri[i]; int cur_amt = obj.buyshare(unit_price,share); System.out.println(" Shares bought : "+share); System.out.println(" Total amount : "+cur_amt); shr[i] = shr[i] - share; amt[i] = amt[i] - cur_amt; cust_shr[i] = cust_shr[i] + share; cust_amt[i] = cust_amt[i] + cur_amt; break; }} break; case 2: System.out.println("t SELL SHARES "); System.out.println(" Enter the company ID : "); cmid = Integer.parseInt(br.readLine()); System.out.println(" Enter the customer ID : "); csid = Integer.parseInt(br.readLine()); for(int i=0;i<n;i++) { if(cmid==comp_id[i] && csid==cust_id[i]) { System.out.println(" Enter the number of shares to sell : "); int share = Integer.parseInt(br.readLine()); int unit_price = ctshr_pri[i]; int cur_amt = obj.sellshare(unit_price,share); System.out.println(" Shares sold : "+share); System.out.println(" Total amount : "+cur_amt); shr[i] = shr[i] + share; amt[i] = amt[i] + cur_amt; cust_shr[i] = cust_shr[i] - share; cust_amt[i] = cust_amt[i] - cur_amt; break; } } break; case 3: for(int i=0;i<n;i++) { System.out.println("ttt Company Details "); System.out.println("t Company ID : "+comp_id[i]); System.out.println("t Company name : "+comp_name[i]); System.out.println("t Company Shares : "+shr[i]); System.out.println("t Total Amount of Shares Owned : "+amt[i]); System.out.println("ttt Customer Details "); System.out.println("t Customer ID : "+cust_id[i]); System.out.println("t Customer Name : "+cust_name[i]); System.out.println("t Total Number of Shares Owned : "+cust_shr[i]); System.out.println("t Total Amount of Shares Owned : "+cust_amt[i]);
  • 5. } break; } System.out.println(" Press 1 to continue... "); repeat = Integer.parseInt(br.readLine()); }while(repeat==1); } catch (Exception e1) { System.out.println("ERROR : " + e1) ; e1.printStackTrace(System.out); } } } OUTPUT ****** Z:st>idlj -fall stock.idl Z:st>javac *.java Note: .stck_marketstockPOA.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Z:st>javac *.java stck_market/*.java Note: stck_marketstockPOA.java uses unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. Z:st>orbd -ORBInitialPort 2500 Z:st>java server -ORBInitialPort 2500 Server ready... CORBA APPLICATION FOR STOCK MARKET ~~~~~ ~~~~~~~~~~~ ~~~ ~~~~~ ~~~~~~ Enter the number of company & customer to be registered : 1 Company Registration Enter the company ID : 1234 Enter the company name : cicso Enter the company address : northstreet Enter the company shares : 100 Enter the unit priCe of shares : 50 Enter the total amount of shares owned : 80 Customer Registration Enter the customer ID : 101 Enter the customer name : RAJA Enter the customer address : M.G,.R nagar Enter the number of shares owned : 40 Enter the unit prize of shares :
  • 6. 40 Enter the total amount of shares owned : 10 1 - > BUY SHARES 2 - > SELL SHARES 3 - > LIST THE DETAILS Enter the choice : 1 BUY SHARES Enter the company ID : 1234 Enter the customer ID : 101 Enter the number of shares to buy : 15 Shares bought : 15 Total amount : 750 Press 1 to continue...
  • 7. 40 Enter the total amount of shares owned : 10 1 - > BUY SHARES 2 - > SELL SHARES 3 - > LIST THE DETAILS Enter the choice : 1 BUY SHARES Enter the company ID : 1234 Enter the customer ID : 101 Enter the number of shares to buy : 15 Shares bought : 15 Total amount : 750 Press 1 to continue...