Skip to content

Commit

Permalink
Minor Project Completed
Browse files Browse the repository at this point in the history
  • Loading branch information
MartyMiniac committed Feb 16, 2020
1 parent 162c10b commit 5deca06
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions Semester 2 (DSA)/minor/Program.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
/*
Created By Rohan Verma
Created using Java 13.0.2
Softwares used Sublime 3 Text Editor
Compiled Using terminal
Default Java Library used
*/
import java.util.*;
public class Program
{
final public String programAuthorName="Rohan Verma";
final public String registrationNumber="1941012661";
Books b[] = new Books[10];
Student student[];
public static void main(String args[])
Expand Down Expand Up @@ -190,7 +200,6 @@ public boolean getIssue(String s)
{
n=i;
System.out.println("Book Found Getting an Issue");
addBook(b[n]);
break;
}
}
Expand All @@ -199,7 +208,9 @@ public boolean getIssue(String s)
int t=b[n].getQty();
if(t!=0)
{
//System.out.println("quantity reduced from "+t);
b[n].setQty(t-1);
addBook(b[n]);
return true;
}
else
Expand Down Expand Up @@ -250,17 +261,17 @@ public void depositBook()
public boolean returnBook(String s)
{
int n=-1;
for(int i=0; i<10; i++)
for(int i=0; i<list.length; i++)
{
int t=-1;
String nm=b[i].getName();
String nm=list[i].getName();
if(nm.equalsIgnoreCase(s))
{
t=i;
}
try
{
if(removeBook(b[t]))
if(removeBook(list[t]))
{
n=i;
System.out.println("Book Found, Unissueing");
Expand Down Expand Up @@ -312,8 +323,7 @@ public void addBook(Books bk)
{
//throw exception because the object not initalized
System.out.println("Book Added to Issue List");
list[i] = bk;
list[i].setQty(1);
list[i] = new Books(bk.getName(), bk.getAuthor(), bk.getPrice(), 1);
break;
}
}
Expand Down

0 comments on commit 5deca06

Please sign in to comment.