Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6

Thread: coursework help

  1. #1
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts

    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.



  • #2
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts
    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

  • #3
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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

  • #4
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,711
    Thanks
    41
    Thanked 191 Times in 190 Posts
    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

  • Users who have thanked alykins for this post:

    rachel_d (12-20-2011)

  • #5
    New to the CF scene
    Join Date
    Dec 2011
    Posts
    3
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Thankyou alykins! =]

  • #6
    Senior Coder DanInMa's Avatar
    Join Date
    Nov 2010
    Location
    Salem,Ma
    Posts
    1,577
    Thanks
    13
    Thanked 248 Times in 248 Posts

    Thumbs up

    Quote Originally Posted by rachel_d View Post
    Thankyou alykins! =]
    see, there you go . I wish you luck!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •