Okay, i got this coding from a friend. He is my old old old senior. Since i am really a total newbie in the course im taking at the moment, I asked him for a help. But he's not in the same college as i am anymore (he further his study away from our place) and he's been busy with his on project and group project, so he gave me this coding as a guide for my homework..because it is almost the same.
The things is I keep getting this on my command prompt(cmd),
"Note: Question5.java uses or overrides a deprecated API.
Note: Recompile with =Xlint:deprecation for details"
What is it actually? How can i fix it? Where to fix it? Please provide a step-by-step instruction for me for it is hard for me to understand this new subject
This are the codes..
import java.io.*;
public class Question5{
public static DataInputStream k = new DataInputStream(System.in);
public static String IsbNo[] = new String[100];
public static String name[] = new String[100];
public static String category[] = new String[100];
public static int x=1;
public static void main(String[] args)throws IOException {
menu();
}
public static void menu()throws IOException {
spacing();
System.out.println("Welcome to My Library");
System.out.println("MENU");
System.out.println("[1]-Add\n[2]-Edit\n[3]-Delete\n[4]-Search\n[5]-View\n[6]-Exit");
System.out.print("Select a menu: ");
int m = Integer.parseInt(k.readLine());
switch(m) {
case 1: //ADD
addRecord();
break;
case 2: //EDIT
editRec();
break;
case 3: //DELETE
DeleteRecord();
break;
case 4: //SEARCH
SearchRecord();
break;
case 5: //VIEW
viewRecord();
break;
case 6: //EXIT
break;
default:
break;
}
}
public static void DeleteRecord()throws IOException {
boolean retbol = false;
int indx=0;
spacing();
System.out.print("-->DELETE RECORDS<--\n\n\n");
System.out.print("Search ISBNo.: ");
String sisbno = k.readLine();
for(int i=1;i<IsbNo.length;i++) {
if(IsbNo[i] !=null) {
if(sisbno.equalsIgnoreCase(IsbNo[i])) {
retbol = true;
indx = i;
}
}
}
if(retbol==true) {
System.out.print("ISBNo.: "+IsbNo[indx].toUpperCase()+ " ");
System.out.print("Name: "+name[indx].toUpperCase()+ " ");
System.out.print("Category: "+category[indx].toUpperCase()+ " ");
System.out.println("");
System.out.print("Save this record?[y]-y/[n]-no: ");
String Q = k.readLine();
if(Q.equalsIgnoreCase("y")) {
IsbNo[indx] = null;
name[indx] = null;
category[indx] = null;
for(int j=indx+1;j<IsbNo.length;j++) {
IsbNo[j-1] = IsbNo[j];
name[j-1] = name[j];
category[j-1] = category[j];
}
System.out.println("Record succesfully deleted!");
System.out.println("\n\n\n<Press Enter>");
String Q1 = k.readLine();
spacing();
menu();
}else {
spacing();
menu();
}
}else {
System.out.print("ISBNo. Number not found!");
System.out.println("\n\n\n<Press Enter>");
String Q = k.readLine();
spacing();
menu();
}
}
public static void SearchRecord()throws IOException {
boolean retbol = false;
int indx=0;
spacing();
System.out.print("-->SEARCH RECORDS<--\n\n\n");
System.out.print("Search ISBNo. : ");
String sisbno = k.readLine();
for(int i=1;i<IsbNo.length;i++) {
if(IsbNo[i] !=null) {
if(sisbno.equalsIgnoreCase(IsbNo[i])) {
retbol = true;
indx = i;
}
}
}
if(retbol==true) {
System.out.print("ISBNo.: "+IsbNo[indx].toUpperCase()+ " ");
System.out.print("Name: "+name[indx].toUpperCase()+ " ");
System.out.print("Category: "+category[indx].toUpperCase()+ " ");
System.out.println("");
System.out.println("\n\n\n<Press Enter>");
String Q = k.readLine();
spacing();
menu();
}else {
System.out.print("ISBNo. Number not found!");
System.out.println("\n\n\n<Press Enter>");
String Q = k.readLine();
spacing();
menu();
}
}
public static void addRecord()throws IOException {
spacing();
System.out.print("-->ADD RECORDS<--\n\n\n");
System.out.print("ISBNo.: ");
String sisbno = k.readLine();
System.out.print("Book NAME: ");
String sname = k.readLine();
System.out.print("Category: ");
String scategory = k.readLine();
System.out.print("Are you sure to save this record?[y]-y/[n]-no: ");
String Q = k.readLine();
if(Q.equalsIgnoreCase("y")) {
IsbNo[x] = sisbno;
name[x] = sname;
category[x] = scategory;
x++;
spacing();
menu();
}else if(Q.equalsIgnoreCase("n")) {
spacing();
menu();
}
}
public static void spacing() {
System.out.print("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n");
}
public static void viewRecord()throws IOException {
boolean ctr=false;
spacing();
System.out.print("-->VIEW RECORDS<--\n\n\n");
for(int i=1;i<IsbNo.length;i++) {
if(IsbNo[i] !=null) {
System.out.print("ISBNo.: "+IsbNo[i].toUpperCase()+ " ");
System.out.print("Name: "+name[i].toUpperCase()+ " ");
System.out.print("Category: "+category[i].toUpperCase()+ " ");
System.out.println("");
ctr=true;
}
}
if(ctr==false) {
System.out.print("\nEMPTY DATABASE NO RECORDS FOUND!");
}
System.out.println("\n\n\n<Press Enter>");
String Q = k.readLine();
spacing();
menu();
}
public static void editRec()throws IOException {
boolean retbol = false;
int indx=0;
spacing();
System.out.print("-->EDIT RECORDS<--\n\n\n");
System.out.print("Search ISBNo. Num: ");
String sisbno = k.readLine();
for(int i=1;i<IsbNo.length;i++) {
if(IsbNo[i] !=null) {
if(sisbno.equalsIgnoreCase(IsbNo[i])) {
retbol = true;
indx = i;
}
}
}
if(retbol==true) {
System.out.print(IsbNo[indx] + " " +name[indx]+ " " +category[indx]+ " \n\n\n\n");
System.out.print("Book Name: ");
String snameedit = k.readLine();
System.out.print("Category: ");
String scategoryedit = k.readLine();
System.out.print("Are you sure to update this record?[y]-y/[n]-no: ");
String Q = k.readLine();
if(Q.equalsIgnoreCase("y")) {
name[indx] = snameedit;
category[indx] = scategoryedit;
spacing();
menu();
}
}else {
System.out.print("ISBNo. not found!");
System.out.println("\n\n\n<Press Enter>");
String Q = k.readLine();
spacing();
menu();
}
}
}