Go Back   CodingForums.com > :: Server side development > Java and JSP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 12-20-2011, 01:07 PM   PM User | #1
rachel_d
New to the CF scene

 
Join Date: Dec 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
rachel_d is an unknown quantity at this point
coursework help

Hi there,

I've recently been set some coursework to create a TCP client/server inventory program (java) and I'm really confused. I have the client/server code, I just don't know how to meet the criteria as follows. If someone could point me in the right direction, it would be much appreciated as I'm really stressing out. Thanks!

A CD shop with an inventory containing the following items:

item code CD name Artist Name Price Quantity in stock.

The inventory should be read by a TCP server program from a file separated by tabs. (text file)

The server waits for client requests and transmits the inventory if an "I" is received.
If a "B" followed by an item code is received, the quantity in stock should be updated to reflect that an item has been bought.

A client program should connect to the server, download the inventory and display it to the customer.

The customer should be able to buy any item by typing in the item's code. A shopping trolley should keep track of the items selected by the customer and give a total price for the whole transaction.


rachel_d is offline   Reply With Quote
Old 12-20-2011, 03:20 PM   PM User | #2
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,335
Thanks: 13
Thanked 207 Times in 207 Posts
DanInMa is on a distinguished road
not to be a pain, but are you asking for someone to write this for you or what do you need?
Refer to the forum rules #1.5 - http://www.codingforums.com/rules.htm

that being said, if you need some assistance with a specific problem in code you've already tried you should probably post the code you are struggling with so someone can assist you
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Old 12-20-2011, 04:01 PM   PM User | #3
rachel_d
New to the CF scene

 
Join Date: Dec 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
rachel_d is an unknown quantity at this point
yeah i understand that. i'm just looking for guidance as to how I would go about each part.

1) for instance "The inventory should be read by a TCP server program from a file separated by tabs. (text file)"

i'm not sure how to seperate the artist/quantity etc. by tabs inside the text file...

2) The server waits for client requests and transmits the inventory if an "I" is received.
If a "B" followed by an item code is received, the quantity in stock should be updated to reflect that an item has been bought.


i'm really not sure what method is used to enable the client to type "I" to transmit the entry. I'm guessing BufferedReader is used but i'm not sure how to do this. And same goes with the "B" affecting quantity of stock.

I'm not asking you to do the work for me, I'm just asking for a few pointers to set me on my way. My teacher isn't the best of help and I have asked but I still don't really understand. Thankyou R
rachel_d is offline   Reply With Quote
Old 12-20-2011, 05:46 PM   PM User | #4
alykins
Senior Coder

 
alykins's Avatar
 
Join Date: Apr 2011
Posts: 1,608
Thanks: 37
Thanked 183 Times in 182 Posts
alykins will become famous soon enough
Java tcp stuff

Java file stuff

format string "case"

Java switch and case stuff

Java escape sequences

Code:
tcp client listen for server tcp
convert incoming byte[] to string and to uppercase
receive message and do something based on case statement
read/write file
send message back
should be more than enough to get you started
__________________

I code C hash-tag .Net
Reference: W3C W3CWiki .Net Lib
Validate: html CSS
Debug: Chrome FireFox IE
alykins is offline   Reply With Quote
Users who have thanked alykins for this post:
rachel_d (12-20-2011)
Old 12-20-2011, 06:02 PM   PM User | #5
rachel_d
New to the CF scene

 
Join Date: Dec 2011
Posts: 3
Thanks: 1
Thanked 0 Times in 0 Posts
rachel_d is an unknown quantity at this point
Thankyou alykins! =]
rachel_d is offline   Reply With Quote
Old 12-21-2011, 04:35 PM   PM User | #6
DanInMa
Senior Coder

 
DanInMa's Avatar
 
Join Date: Nov 2010
Location: Salem,Ma
Posts: 1,335
Thanks: 13
Thanked 207 Times in 207 Posts
DanInMa is on a distinguished road
Thumbs up

Quote:
Originally Posted by rachel_d View Post
Thankyou alykins! =]
see, there you go . I wish you luck!
__________________
- Firebug is a web developers best friend! - Learn it, Love it, use it!
- Validate your code! - JQ/JS troubleshooting
- Using jQuery with Other Libraries - Jslint for Jquery/other JS library users
DanInMa is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:11 PM.


Advertisement
Log in to turn off these ads.