We have been working very hard since 2009 to facilitate in your learning Read More. We can't keep up without your support. Donate Now.

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More

Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Assignment No. 01 Fall 2015 CS506- Web Design and Development Total Marks: 20 Due Date: 24/11/2015

Assignment No. 01

 Fall 2015
CS506- Web Design and Development

Total Marks: 20

Due Date: 24/11/2015

Please read the following instructions carefully before solving & submitting assignment:

It should be clear that your assignment will not get any credit  if:

  • The assignment is submitted after due date.
  • The submitted assignment does not open or file corrupt.
  • The assignment is fully or partially copied from (other student or ditto copy from handouts or internet).
  • Student ID is not mentioned in the assignment File or name of file is other than student ID.
  • The assignment is not submitted in .java format.

 

Uploading instructions

Your submission must include:

 

  1. All the source code (.java files) and other necessary files to compile and run your program.
  2. You have to make one java file and Upload it on VULMS.

 

Note: Use Notepad or Notepad++ for coding and JDK package for java source code compilation and running (A guideline document on JDK installation and configuration is given in course download section)

Objective

The objective of this assignment is to

  • Give you some practice exercise of Classes and Objects. And how to compile and run java programs.
  • Develop GUI (Graphical User Interface) in java
  • Understand the concept of Collections in java

 

 

Problem Statement:                                                        

You are required to write a java program which contains only two classes named as “BookInfo” and “BookMgtSys”.

 

BookInfo class must have the following data members:

  • ISBN
  • Book Name
  • Author Name
  • Total Books

When you will add book then it will increment variable Total Books and decrement when you will delete book.

 

BookInfo class must have the following member methods:

  • Default constructor
  • Parameterized constructor
  • addbook () 
  • searchBook ()
  • deleteBook ()

 

BookMgtSys is a public driver class that contains the main() method. The name of you file should be BookMgtSys as it is a public class in your program.                                                                             

Detailed Description:

Default constructor: The default constructor will create an ArrayList.

Parameterized constructor: It should take three String parameters named as (ISBN, Book Name, and Author Name) and initializes the data members values with the passed parameters.

addBook(): This method will ask the user to enter ISBN, Book name and Author name and then add the book in 

ArrayList and increment the Total Book variable. After successful adding the book, A message box should be displayed containing Book information.

searchBook(): This method takes one parameter which is book name and search the book name in the ArrayList. If search is found then display the Book information otherwise display message that Book not found.

deleteBook(): This method takes one parameter which is book name and delete the book from the ArrayList and then decrement the Total Book variable. 

 

Use JOptionPane for input and output data.

 

Sample Output:

Within main() method, the following message box should be displayed.

 

If user presses 1 then it should ask the user to add further information

Deadline

Your assignment must be uploaded/submitted at or before 24th Nov, 2015.

 

 

For any query about the assignment, contact at cs506@vu.edu.pk

GOOD LUCK


+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)


Views: 17029

Attachments:

Replies to This Discussion

  • Student ID is not mentioned in the assignment File or name of file is other than student ID.
  • The assignment is not submitted in .java format.


is ka mtlb ha k agr assignment main student id k alava name likha hva ya file java main na hoe to koe number nhe milna.yeni java file or file name as ur id must 

.java my assignment upload ni krna. matlb .txt my assignment upload kary. aur Student ID na likhy?

book info ke class static or inner class hogi tbhi bookmgtsys ke

ye kis ne kha ha

pouch rahi hun?

its complete

create a text document file save code in it replace vuid with ur id like mc1... save file as cs506.java 

package bookpkg;

import java.util.ArrayList;
import javax.swing.JOptionPane;

public class vuid

public static void main(String[] args) 
{
BookInfo bookObj = new BookInfo();
String inputStr = null;
int intVal = 0;

while(true)
{
inputStr = JOptionPane.showInputDialog("Enter 1 to Add Book\n"
+ "Enter 2 to Search Book\nEnter 3 to Delete Book\nEnter 4 to Exit System");
intVal = Integer.parseInt(inputStr);

if(intVal == 1)
{
String ISBN = JOptionPane.showInputDialog("Enter the ISBN");
String bookName = JOptionPane.showInputDialog("Enter the Book Name");
String authorName = JOptionPane.showInputDialog("Enter the Author Name");

bookObj.addBook(ISBN, bookName, authorName);
}
else if(intVal == 2)
{
if(bookObj.totalBooks > 0)
{
inputStr = JOptionPane.showInputDialog("Enter Book Name to Search");
bookObj.searchBook(inputStr);
}
else
{
JOptionPane.showMessageDialog(null, "There is no book in the list!");
}
}
else if(intVal == 3)
{
if(bookObj.totalBooks > 0)
{
inputStr = JOptionPane.showInputDialog("Enter Book Name to Delete");
bookObj.deleteBook(inputStr);
}
else
{
JOptionPane.showMessageDialog(null, "There is no book in the list!");
}
}
else if(intVal == 4)
{
System.exit(0);
}
else
{
JOptionPane.showMessageDialog(null, "Invalid Input!");
}
}
}

public static class BookInfo 
{
private String ISBN;
private String bookName;
private String authorName;
public int totalBooks = 0;
private ArrayList arr = new ArrayList<BookInfo>();

public BookInfo()
{
this.ISBN = null;
this.bookName = null;
this.authorName = null;
}

public BookInfo(String ISBN, String bookName, String authorName)
{
this.ISBN = ISBN;
this.bookName = bookName;
this.authorName = authorName;
}

public void addBook(String ISBN, String bookName, String authorName)
{
BookInfo temp = new BookInfo(ISBN, bookName, authorName);
this.arr.add(temp);
this.totalBooks++;
JOptionPane.showMessageDialog(null, "Book Name: " + bookName + 
" Added Successfully!\nTotal Books: " + this.totalBooks);
}

public int searchBook(String bookName)
{
int index = -1;
BookInfo temp = new BookInfo();

for(int i = 0; i < this.arr.size(); i++)
{
temp = (BookInfo) this.arr.get(i);

if(temp.bookName.equals(bookName))
{
index = i;
}
}

if(index != -1)
{
JOptionPane.showMessageDialog(null, "Book Found Successfully!\nISBN: " + temp.ISBN + 
"\nBook Name: " + temp.bookName + "\nBook Author: " + temp.authorName);
return index;
}
else
{
JOptionPane.showMessageDialog(null, "Book Name: " + bookName + 
" Not Found!");
return -1;
}
}

public void deleteBook(String bookName)
{
int index = this.searchBook(bookName);

if(index != -1)
{
this.arr.remove(index);
this.totalBooks--;
JOptionPane.showMessageDialog(null, "Book Name: " + bookName + 
" Deleted Successfully!\nTotal Remaining Books: " + this.totalBooks);
}
}
}
}

this code i not workig M.Tariq Sb.

this error shows

ik yhi code to sab sy best working kr rha hai.

there is no error.

plz koi to hlp kr dy mera  JDK instal ni ho rha

 id kahn likhna hy test file m?kahn replac krna hy

dear,i've already gave u a link to understand jdk installment procedure in previous comments.check that.

at the uper part of code, in 1st class 

public class vuid

replace vuid with your bc120....

public class vuid bs090

kea esy ?malika

RSS

Latest Activity

+M.Tariq Malik liked +M.Tariq Malik's discussion MGMT617 GDB Fall 2020 Solution / Discussion
55 seconds ago
+M.Tariq Malik added a discussion to the group MGMT617 Production Planning and Inventory Control
1 minute ago
+M.Tariq Malik replied to +M.Tariq Malik's discussion CS603 Assignment 01 Fall 2020 Solution / Discussion Due Date: 26-11-2020 in the group CS603 Software Architecture and Design
5 minutes ago
Profile IconJoshua, Mian Hasseb Ahmad, Muhammad Zubair and 19 more joined Virtual University of Pakistan
9 minutes ago
♦_"Tooba Jutt"_♦ liked Pooja kumari's discussion quiz discussion
16 minutes ago
♦_"Tooba Jutt"_♦ liked +M.Tariq Malik's discussion Don't Worry About Your Assignments, GDBs & Online Quizzes
17 minutes ago
♦_"Tooba Jutt"_♦ liked Mani Siddiqui Ex's discussion Free Programming Essentials in Python
17 minutes ago
Ꮆㄩフフ卂尺 liked KINZAR IMAN.'s profile
28 minutes ago
Profile IconMuhammad Abid and Hj joined +M.Tariq Malik's group
29 minutes ago
Siddiq khan kakar liked +M.Tariq Malik's discussion CS302 Mid Term Papers Fall 2019 (14~26 December 2019) & All Solved Past Papers, Solved MCQs & Helping Material
50 minutes ago
M Shabbir posted a status
"Sir acount is locked any body help me plz there are are assignments quizzes and gdb are pending"
2 hours ago
Profile IconKainat Ramzan, Fatima and MUHAMMAD NAJEEB joined +M.Tariq Malik's group
5 hours ago

Looking For Something? Search Here

© 2020   Created by +M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.