Questions

Java Network Programming Assiatance.

+
0 Votes
Locked

Java Network Programming Assiatance.

fregeneo
I need help with the coding of this web application. I am new to java programming and need serious assistance with this. Its an online CD store.

A CD shop with an inventory containing the following items:

| Item code | CD name | Artist Name | Price | Quantity in stock |

The above items would be be inform of textfields to receive inputs on the graphical user interface using java swings.


The inventory should be read by a TCP server program from a file separated by tabs or into a database.


The server waits for client requests and transmits the inventory if an "I" is received with it.


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.


An algorithm, class diagram, flow charts and required java codes.


Interpretation

ITEM | CD | ARTIST | ITEM | QUANTITY
CODE | NAME | NAME | PRICE | IN STOCK
0001 A QA 170 30
0002 B QB 120 17
0003 C QC 140 15
0004 D QD 200 50
0005 E QE 300 10
0006 F QF 400 10
0007 G QG 100 15


Table above is an example of the inventory file stored in tab-delimited form.

File name ? INVENTORY.JAV

?If server receives ?I?, it sends inventory to client
?If server receives ?B? followed by he item code(e.g. B0001), quantity is updated for that code to reflect sale.

i.e. Quantity in stock = Quantity in stock ? quantity sold

?Client program should connect to server,
download file and display contents.

?Customer should be able t buy item by typing in the item code.

?Shopping trolley should keep track of items selected.

i.e. input = Item code . Unit Price . Quantity . Price

Total Price Check out = Sum of all price.


Thank you all!!!!
  • +
    0 Votes
    guillermo.pena

    Hi there.
    Just a few suggestions:
    You can store your cd Inventory in Database, like Oracle or MySQL.Later you can develop a a swing client and access the remote Database
    using JDBC, you can have your Inventory online everytime that the users opens the application, and you can use a Java Data Structure like a LinkedList for you shopping Car.I dont know if you require assistance **** this.
    Regards Memo

    +
    0 Votes
    henrywu21

    "Developing a Spring Framework MVC application step-by-step":
    http://www.springframework.org/docs/Spring-MVC-step-by-step/index.html

    +
    0 Votes
    guillermo.pena

    Yes, That will be a good start for a web based app.
    Struts and Hibernate can be used too.

    +
    0 Votes
    rob_cranfill

    Why do I get the feeling we're being asked to help with someone's homework? Oh, well, let's press on....

    I can't imagine you are "seriously" going to implement this as an online CD store, which is why it smells like "homework" to me. In which case the suggestions already made here, to use Spring or a framework like that is not only overkill for a toy application that will be thrown away in a week, but also of course out of bounds as a solution for your assignment.

    So, that said, I suggest you look at the Java docs for the "ServerSocket" and "Socket" classes (also Google for those along with "example" or "sample code").

    Also, you can - and should! - design a NON-networked version that uses Java "interfaces" to test out the interaction between client and server, *before* you add in the networking code. It will help you separate the two issues, and be a valuable aid in development and debugging.

    - rob

  • +
    0 Votes
    guillermo.pena

    Hi there.
    Just a few suggestions:
    You can store your cd Inventory in Database, like Oracle or MySQL.Later you can develop a a swing client and access the remote Database
    using JDBC, you can have your Inventory online everytime that the users opens the application, and you can use a Java Data Structure like a LinkedList for you shopping Car.I dont know if you require assistance **** this.
    Regards Memo

    +
    0 Votes
    henrywu21

    "Developing a Spring Framework MVC application step-by-step":
    http://www.springframework.org/docs/Spring-MVC-step-by-step/index.html

    +
    0 Votes
    guillermo.pena

    Yes, That will be a good start for a web based app.
    Struts and Hibernate can be used too.

    +
    0 Votes
    rob_cranfill

    Why do I get the feeling we're being asked to help with someone's homework? Oh, well, let's press on....

    I can't imagine you are "seriously" going to implement this as an online CD store, which is why it smells like "homework" to me. In which case the suggestions already made here, to use Spring or a framework like that is not only overkill for a toy application that will be thrown away in a week, but also of course out of bounds as a solution for your assignment.

    So, that said, I suggest you look at the Java docs for the "ServerSocket" and "Socket" classes (also Google for those along with "example" or "sample code").

    Also, you can - and should! - design a NON-networked version that uses Java "interfaces" to test out the interaction between client and server, *before* you add in the networking code. It will help you separate the two issues, and be a valuable aid in development and debugging.

    - rob