Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

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

Views: 17184

Attachments:

Replies to This Discussion

Gondal sb ye 2 files means 2 classes BookInfo and BookMgtSys en ko aik he file me submit krwana hei notepad  ke??

Dear class 2 hain file only 1 hai. aik BookMgtSys ki class h aor aik BookInfo ki. Jb .java ki file open karain to direct BookMgtSys jis me main() h wo class open ho 2nd wali auto ho jae gi.

Instructor says, You have to make one java file and Upload it on VULMS.

But I make 3 files because I want you to do something yourself. I mean, everyone will make single file according to his pattern and will not be considered as copy/paste. 

However you can submit 3 files with .java, zip and upload them. 

ye errors day raha hy

ap k pas jdk ka software hai 

plz share 

Atlas Gondal  thanks for sharing 

Note for All Members: You don’t need to go any other site for this assignment/GDB/Online Quiz solution, Because All discussed data of our members in this discussion are going from here to other sites. You can judge this at other sites yourself. So don’t waste your precious time with different links.

:) hmmm, no problem!

please update with java extension

Here is a complete code of java assignment paste it in a notepad file and save it with name "BookMgtSys.java" but sure to make changes in it .......


import java.util.ArrayList;

import javax.swing.JOptionPane;


public class BookMgtSys {


public static void main(String[] args) {

BookInfo BkInfo=new BookInfo();

String abc,pane;

int ch;

while(true){
abc = JOptionPane.showInputDialog("Enter 1 to add book " + "\n Enter 2 to Search book \n Enter 3 to Delete book" + "\n Enter 4 to Exit");
ch = Integer.parseInt(abc);

switch (ch) {
case 1:

BkInfo.addbook();
break;

case 2:
pane = JOptionPane.showInputDialog("Enter book name to search ");
BkInfo.searchbook(pane);
break;

case 3:
pane = JOptionPane.showInputDialog("Enter book name to delete ");
BkInfo.deletebook(pane);
break;

case 4:
System.exit(0);
}
}



}
public static class BookInfo{

public String ISBN;
public String BookName;
public String AuthorName;


ArrayList<BookInfo>bookarray;

public BookInfo(){
bookarray = new ArrayList<BookInfo>();

}

public BookInfo(String isbn, String bookname, String authorname) {
ISBN = isbn;
BookName = bookname;
AuthorName = authorname;

}



public void print() {
JOptionPane.showMessageDialog(null, "ISBN \t " + ISBN + " BookName \t" + BookName + " AuthorName \t" + AuthorName);

}
public void addbook(){
String isbn=JOptionPane.showInputDialog("Enter ISBN");

String bookname=JOptionPane.showInputDialog("Enter Book Name");

String authorname=JOptionPane.showInputDialog("Enter Author Name");

BookInfo b= new BookInfo(isbn,bookname,authorname);
bookarray.add(b);




}
//serch book record by name iterating over arraylist
public void searchbook(String n){
for(int i=0;i<bookarray.size();i++){
BookInfo b=(BookInfo) bookarray.get(i);
if(n.equals(b.BookName)){
b.print();

}


}

}
public void deletebook(String n){
for(int i=0;i<bookarray.size();i++){

BookInfo b=(BookInfo) bookarray.get(i);

if(n.equals(b.BookName)){

bookarray.remove(i);


}
}

}
}

}

kiya change karna hai is code mai se plzz tell fast

Above code show this error

Attachments:

plz help me

jdk install hi nhi horaha hai

kisi k pas us ka setup hai plz share .......

RSS

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

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