+ All Categories
Home > Documents > Java Programming

Java Programming

Date post: 21-Nov-2014
Category:
Upload: a-rehman-habibani
View: 145 times
Download: 5 times
Share this document with a friend
Popular Tags:
19
REPORT ON BOOK INVENTORY PROGRAM ADVANCED PROGRAMMING SD 2022 Submitted by Abdul Rehman Habibani
Transcript
Page 1: Java Programming

REPORT ON BOOK INVENTORY PROGRAM

ADVANCED PROGRAMMING

SD 2022

Submitted by Abdul Rehman Habibani

Table Of Content

Page 2: Java Programming

S.No CONTENT PAGE

1 ABSTRACT AND INTRODUCTION 1

2 PURPOSE OF THIS PROJECT 1-2

3 ROLE PLAYED BY THE PROJECT

4 FUTURE OF THE PROJECT

5 FLOW CHART

6 ERROR SOLVING

7 PROGRAM CODING

8 SCREEN SHOTS WITH EXPLANATION

9 CONCLUSION

10 REFERENCES AND BIBLOGRAPHY

ABSTRACT

The principle of this project is to make a program using java programming language and built a software for book inventory system which holds the data of the books.

Page 3: Java Programming

INTRODUCTON

This software can be useful for different groups, bookshop library and internet shop and it is just right for any business. It can be modified easily as per needs. The software records keep the record for books and display the available amount of books, name of author and book name. This software is user friendly and one can easily buy books from it. The result of the software has satisfied the whole requirement for the store.

In this project I will be making software in JAVA that keeps the inventory of books in library.”The Java programming language is a general-purpose, concurrent, class-based, object-oriented language. It is designed to be simple enough that many programmers can achieve fluency in the language. The Java programming language is related to C and C++ but is organized rather differently” [1].The whole program will be developed using Java Development Kit (JDK). The program can also be made in C++ but the aim of our coursework is to make it is Java. Member functions and constructors will also be used in the program to make it. Java Eclipse is used to design this program because it is simple to be implement and find any errors in the program.

This program can record, search, remove, and keep detail of all books which is in library The base of the program will lie on if then else statement people can also use switch statement but I prefer if then else because it’s straightforward and easy to understand. The program will be taken though different phases which are requirement, design, implementation, verification and maintenance. To understand the program in more depth a flow chart is also designed to show the flow of data which will provide easy understanding of the program to anyone. To show the successful execution phase of the program a screen shorts is also given and also during the testing phase errors will also be dealt with and clarified how it was removed from the program

PURPOSE OF THE PROJECT

Page 4: Java Programming

The main purpose of this project that was developed of a bookstore to maintain computer based program that will allow the staff of the store to maintain and accurate record of books inventory with will also allow them to

Choose the book from list of a catalogue such as Ibne Batota, shekspare in layari, Programming world and nuzhat classic.

Allow the user to choose the title of book, book author, book publisher, and book price.

The system will look for of the books which the user enters according to the above fields then display the result if the books is available in the store .

The user’s required quantity according to the requirement.

Update the system inventory record if any book was sold.

ROLE PLAYED BY THE PROJECT

The program for this project was developed using JAVA which is simple, Reliability for which Java is one of the first programming languages to consider security as part of its design. The Java language, compiler, interpreter, and runtime environment were each developed with security in mind. The compiler, interpreter, and Java-compatible browsers all contain several levels of security measures that are designed to reduce the risk of security compromise, loss of data and program integrity, and damage to system users. Considering the enormous security problems associated with executing potentially untrusted code in a secure manner and across multiple execution environments, Java's security measures are far ahead of even those developed to secure military systems. The program will first display the following

Book title: - this means the user should enter a valid book title choosing from the catalogue

Book quantity: - this means the user should enter the quantity of book sold if any must be specify

Book author:- this means the user must enter the author of the book if he/she are researching for any specific book

Book publisher:- this means the user must enter the publisher’s name for ordering any books

Book price: - this means the prize of the book must be given

FUTURE OF THE PROJECT

Page 5: Java Programming

This project can be improved with extra futures such as Internet book ordering using websites such as waterstones.com, which can increase the future of convenience to the bookstore. Increase the catalogue of books collection that may include fiction, crime and other interest of the people. Increase the features of the project with oracle database connecting using java script and java applets The software can be attached to an oracle data base so it will be capable of holding more data than its current size. This program can also be altered means that DVD rental shop can also use it as an alternative of borrowing books name of DVD can be entered entities can be changed o it can also be used for a different business like for a DVD shop

FLOW CHART

Page 6: Java Programming

PROGRAM CODING

Page 7: Java Programming

import java.io.*;public class BookInventory {String bookTitle[] = {"Ibne Batota","shekspare in layari","Programming world","Nuzhat Classic"};String quantity[] = {"5200","2310","2250","2500"};String author[] = {"Mukhtara mai","nora masi","prof william","Hakeem Lukman"};String publisher[] = {"Hab publishers","Hab publishers","Hab publishers","Hab publishers"};String price[] = {"16","65","25","50"};

String name;int j;boolean done = false;

InputStreamReader input;BufferedReader br;public BookInventory() throws IOException{input = new InputStreamReader(System.in);br = new BufferedReader(input);

System.out.println("\n\t\t -----------------------------------");System.out.println("\t\t++++| Habibani says welcome to HB online |++++");System.out.println("\n\t\t++++| Book store. |++++");System.out.println("\n\t\t++++| Please select one of the |++++");System.out.println("\n\t\t++++| options below: |++++");System.out.println("\t\t----------------------------------------");

callOptions();}public void callOptions() throws IOException{System.out.println("\n1. View all Books!");System.out.println("2. Find a book!");System.out.println("3. Purchase a book!");System.out.println("4. Exit from the program");System.out.print("\n\tPlease select only one option:\t");String readLine = br.readLine();int read = Integer.parseInt( readLine );

if(read == 1){getAllBooks();}else if(read == 2){getOneBook();}else if(read == 3){getPurchaseABook();}else if(read == 4){System.out.println("\nProgram exited");System.exit(0);}

Page 8: Java Programming

else{System.out.println("\nPlease select only from the options above");callOptions();}}public void getAllBooks() throws IOException{System.out.println("\nBook Title Author Publisher

Quantity Price");System.out.println("================================================================================");System.out.println(bookTitle[0]+" "+author[0]+" "+publisher[0]+" "+quantity[0]+" "+price[0]);System.out.println(bookTitle[1]+" "+author[1]+" "+publisher[1]+"

"+quantity[1]+" "+price[1]);System.out.println(bookTitle[2]+" "+author[2]+" "+publisher[2]+"

"+quantity[2]+" "+price[2]);System.out.println(bookTitle[3]+" "+author[3]+" "+publisher[3]+" "+quantity[3]+" "+price[3]);

callOptions();

}public void getOneBook() throws IOException{System.out.print("\nEnter the name of a Book:\t");String name = br.readLine();

for(int i=0;i<bookTitle.length;i++){if(name.equalsIgnoreCase(bookTitle[i])){done = true;if(bookTitle[i] == "Ibne Batota"){System.out.println("\nBook Title Author Publisher Quantity Price");System.out.println("================================================================================");System.out.println(bookTitle[i]+" "+author[i]+" "+publisher[i]+" "+quantity[i]+" "+price[i]);

}else if(bookTitle[i] == "shekspare in layari"){System.out.println("\nBook Title Author Publisher Quantity Price");System.out.println("================================================================================");System.out.println(bookTitle[i]+" "+author[i]+" "+publisher[i]+" "+quantity[i]+" "+price[i]);}else if(bookTitle[i] == "Programming world"){

Page 9: Java Programming

System.out.println("\nBook Title Author Publisher Quantity Price");System.out.println("================================================================================");System.out.println(bookTitle[i]+" "+author[i]+" "+publisher[i]+" "+quantity[i]+" "+price[i]);}else if(bookTitle[i] == "Nuzhat Classic"){System.out.println("\nBook Title Author Publisher Quantity Price");System.out.println("================================================================================");System.out.println(bookTitle[i]+" "+author[i]+" "+publisher[i]+" " +quantity[i]+" "+price[i]);}}}if(done == false){System.out.println("\nBook not found:\t");}callOptions();}

public void getPurchaseABook() throws IOException{System.out.print("\nEnter the name of the Book:\t\t");String name = br.readLine();

for(int i=0;i<bookTitle.length;i++){if(name.equalsIgnoreCase(bookTitle[i])){done = true;

System.out.print("What is the quantity you require?\t");String acc = br.readLine();int readAcc = Integer.parseInt(acc);

int prices = Integer.parseInt(price[i]);double totalPrice = readAcc*prices;String total = String.valueOf(totalPrice);

int realQuantity = Integer.parseInt(quantity[i]);int quantities = realQuantity - readAcc;

String quant = String.valueOf(quantities);

System.out.println("\nYour purchase details are as follows:");System.out.println("\nBook Title\t\t"+bookTitle[i]);System.out.println("Author\t\t\t"+author[i]);System.out.println("Publisher\t\t"+publisher[i]);System.out.println("Quantity required\t"+readAcc);System.out.println("Unit price\t\t"+price[i]);System.out.println("Total Price\t\t"+total);

Page 10: Java Programming

System.out.print("\nPurchase this book? (Y for yes / N for no)\t" );String getIt = br.readLine();

if(getIt.equalsIgnoreCase("y") ){quantity[i] = quant;System.out.println("\nThank you for visiting. I hope you come again!");}elseSystem.out.println("\nYou have selected No to stop the transaction. Thanks !");}}if(done == false){System.out.println("\nBook not found:\t");}

callOptions();}

public static void main(String args[])throws IOException{BookInventory obj = new BookInventory();}}

SCREEN SHOTS

Page 11: Java Programming

This is the front page of the program from user side. It displays a number of options to access the program like press 1 to view all books, 2 to find a specific book ,3 to purchase a book and press option 4 to exit to the program. The clients can use these options according to their requirements.

Page 12: Java Programming

In this screen shot you can see that the client selected the option 1 which is to view all books from the book store.This page displays the books ,author,publishers and the amount of books held in the store.

Page 13: Java Programming

User selected option 2 to find a book the system will ask you to enter the name of the book e:g ibne batota then it will show you the author ,publisher ,quantity in stock and price of the book.

Page 14: Java Programming

When the user selected the particular book and requires to proceed further to buy a book then it will press option 3 to purchase a book then the system will ask you the number of books you want to buy for instance in the above screen shot user has selected the book named ibne batota and required number of books are 19.This screen also shows the price for each book and sum of the 19 books which is 304 and in the end system will ask you to purchase a book with yes or no option.

Page 15: Java Programming

In this screen shot the system has been updated after the purchasing of books by the client as you can see the quantity of book title ibne batota is gone down to 5181 after the user bought 19 books.

CONCLUSION

This program which is made using Java as the programming language is though one of the very basic one but the job it is currently doing it tremendous. It can be easily used for any book supplies or a retailer. It can also be used by a library but the program would then need to get connect through a database and some changes has to be made to the software.

I have gained sound knowledge by doing this course work which will help me in future. The program itself now can locate the number of books available, it also shows the author details with the books name. When a book is purchased it is automatically deducted from the database that is very prominent for the user.

REFERENCES

Page 16: Java Programming

1. Patrick Niemeyer and Josh Peck Exploring Java, 2nd Edition O'Reilly Media; (September 1, 1997) ISBN-10: 1565922719.

2. Java Sun. (1995). Learning the Java language. Available: http://java.sun.com/docs/books/tutorial/java/index.html. Last accessed 20 Arp 2010.

3. Loirak . (17 March 2010). Java Programming for beginners in four hours. Available: http://www.loirak.com/prog/java.php. Last accessed 19 March 2010.

4. Programmers’. (17 March 2010). Flow Chart. Available: http://www.programmersheaven.com/2/Beginners-Guide-To-Java. Last accessed 21March 2010.Last Accessed on 23 April 2010.

5. Y.Daniel Liang (2007). Introduction to Java Programming. 6th ed. America: Esternish. 1-5. Accessed on 18 March 2010.

BIBLOGRAPHY

Steven Holzner Java 2 (Jdk 5 Ed.) Programming Black Book Dreamtech Press 2006, 2005ISBN817722655X, 9788177226553

James Gosling, Bill Joy, Guy Steele, and Gilad Bracha, The Java language specification, third edition. Addison-Wesley, 2005. ISBN 0-321-24678-0

Bruce Eckel, Thinking in Java, 4th edition Prentice Hall, 2006 ISBN0131872486,

9780131872486


Recommended