Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


nathan
Java.. pls.
1 Answer(s)      4 years and 6 months ago
Posted in : Java Beginners


Hi, sir. it compiler but when search or purchase it didt go true.
Sir, can u help me sir. Please Sir..

Import java.io.*;

public class nathan{
String title[]={"Biography","Computers","Science","Sports","Religion"};
String author[]={"Francis","Roland","Bobby","Keith","Robbert"};
String publisher[]={"USA","USA","Germany","France","Spain"};
Double price[]={19.00,25.50,20.80,19.60,13.80};
double quantity[]={10,40,32,36,41};
boolean done = false;
InputStreamReader input = new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(input);
public void nathan () throws IOException{
do{
System.out.println();
System.out.println("|!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!|");
System.out.println("| Welcome to |");
System.out.println("| Nathan Book Shop |");
System.out.println(" ------------------------------------------- ");
System.out.println("| 1. All Books |");
System.out.println("| 2. Books By Title |");
System.out.println("| 3. Purchase Books |");
System.out.println("| 4. Exit |");
System.out.println("|~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|");
System.out.println("");
System.out.print("Enter your choice=>");
String op = br.readLine();
int read = Integer.parseInt(op);
switch(read){
case 1:

System.out.println("");
allBooks();
break;

case 2:

System.out.println("");
searchTitle();
break;

case 3:

System.out.println("");
purchase();
break;

case 4:

System.out.println("{{{{THANK YOU}}}}");
done=true;
break;

default:

System.out.print("Wrong Info. Please Enter Again");
}
}
while (!done);
}
public void searchTitle() throws IOException{
System.out.print("Enter Title Name::");
String name = br.readLine();
for(int i=0;i<5;i++){
if(name.equals(title[i])){
System.out.println("Author : "+author[i]);
System.out.println("Publisher : "+publisher[i]);
System.out.println("Price : "+price[i]);
System.out.println("Quantity : "+quantity[i]);
}
}
}
public void purchase() throws IOException{
System.out.print("Enter book name:");
String name = br.readLine();
for(int i=0;i<5;i++){
if(name.equals(title[i])){
System.out.println("Author : "+author[i]);
System.out.println("Publisher : "+publisher[i]);
System.out.println("Price : "+price[i]);
System.out.println("Quantity : "+quantity[i]);
System.out.println("Total Price : "+quantity[i]*price[i]);
}
}
}
public void allBooks()throws IOException{
System.out.println("Title\t\tAuthor\t\tPublisher\tQuantity\tPrice");
System.out.println("=============================================");
for(int a=0; a<author.length;a++){
System.out.println(""+title[a]+"\t"+author[a]+"\t\t|"+publisher[a]+"\t\t|"+quantity[a]+"\t\t|"+price[a]);
System.out.println("");
}
System.out.println("");
}
public static void main(String args[])throws IOException{
nathan bk = new nathan();
bk.nathan();
}
}

Advertisement
View Answers

May 3, 2010 at 10:52 AM


Hi Friend,

Please clarify the format in which you want to display the data on selecting search and purchase option.

Thanks


Related Tutorials/Questions & Answers:
Java.. pls. - Java Beginners
Java.. pls.  Hi, sir. it compiler but when search or purchase it didt go true. Sir, can u help me sir. Please Sir.. Import java.io.*; public class nathan{ String title[]={"Biography","Computers","Science","Sports
Java Beans pls!! - Java Beginners
Java Beans pls!!  hello,, can someone give me a simple program of java beans, and Jsp. pls.. im begging you guys.. i really need it!! plss.. thanks...://www.roseindia.net/jsp/java-bean-example-jsp.shtml http://www.roseindia.net/jsp
Advertisements
pls. help me - Java Beginners
pls. help me  please help me i do need now if its okay... Consider the method headings: void funcOne(int[] alpha, int size) int funcSum(int...[] list = new int[50]; int[] Alist = new int[60]; int num; Write Java
pls send reply - Java Beginners
pls send reply  i get the error Error Occurred:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) how to remove
pls send reply - Java Beginners
pls send reply  i get the error Error Occurred:java.sql.SQLException: Access denied for user 'root'@'localhost' (using password: YES) how to remove   Hi Friend, Check your connection string, username
pls tell me the difference between the run() and start() in threads in java....
pls tell me the difference between the run() and start() in threads in java....  difference between the run() and start() in threads in java
how to make a matrix like datagrid in ide in java pls help
how to make a matrix like datagrid in ide in java pls help  how to make a datagrid mainly matrix in ajava standalone app
hi... pls give me the example of java coding fo following question
hi... pls give me the example of java coding fo following question  example java coding that reads in the radius and length of cylinder and computes volume. formula: Area = radius * radius * PI Volume = area * length
pls send me the code for login and register - Java Beginners
pls send me the code for login and register  pls immediately send me the jsp code for login and registration with validation with java bean in mysql database...  Hi friend, This login action code
hi... pls give me the example of java coding fo following question
hi... pls give me the example of java coding fo following question  Write a java program that reads the following information and prints a payroll statement: Employee‚??s name (e.g: Sam) Number of hours worked in a week (e.g: 10
hi... pls give me the example of java coding for following question
hi... pls give me the example of java coding for following question   Write a program that computes loan payments. The loan can be a car loan, a student loan, or a home mortgage loan. The program lets the user enter the interest
hi.. i hv few error. pls. - Java Beginners
hi.. i hv few error. pls.  hi sir, i have few error. can u pls help me. pls. im very new in java. ths my Uni assgmnt. please help me... import java.io.*; public class nathan { String title[]={"Biography
do the combinations in java, pls help me its urhent - Development process
do the combinations in java, pls help me its urhent  import java.util.*; interface Expression { public void interpret(ArrayList exp); } class OrExpression implements Expression { public void interpret(ArrayList exp
pls help me it urgent
pls help me it urgent  hey, pls help me i want to know that can we call java/.bat file from plsql/proceudre /trigger
pls help me it urgent
pls help me it urgent  hey, pls help me i want to know that can we call java/.bat file from plsql/proceudre /trigger
pls help me it urgent
pls help me it urgent  hey, pls help me i want to know that can we call java/.bat file from plsql/proceudre /trigger
hi , i cant make this programmer , can any one help me to make it pls - Java Beginners
hi , i cant make this programmer , can any one help me to make it pls   In this exercise we would like to build a system in java ( set of classes... java streams (FileReader, FIleWriter,...) and allows creating and opening of new
pls answer - Security
pls answer  what are the difference of open source dbms and proprietary dbms
Pls anyboby tell me...
Pls anyboby tell me...  which book easy to learn spring
pls send code
pls send code   pls send code for set database value into text box based on selected value in struts and jsp   use any database and get its code for getting values from google
Pls send code
Pls send code   I am Mohini Charankar suppose Name="Mohini" Edit Button Click on that I change my Name with "Mohini/" Save it and page refresh After... an error pls send code
Pls help me with strings
Pls help me with strings  To reverse a every other word in a string. Example :- If the input is "This is a line of message" the output should be "sihT is a line fo message
Pls help me with strings
Pls help me with strings  To reverse a every other word in a string. Example :- If the input is "This is a line of message" the output should be "sihT is a line fo message
pls help me with this question
pls help me with this question  how to write a program in C++ using encapsulation,polymorphism,inheritance and abstraction?(all these concepts should come in a single program
i dont no how to solve it pls
i dont no how to solve it pls   Calculate and display the sum of all prime number from 1 to 100 covert in java system codes
pls answer the Trangle pattern
pls answer the Trangle pattern    a b c d e b c d e c d e d e e Please answer and give the code for above triangle
Pls help me...........
Pls help me...........  how to use the text file as input to insert the values injdbc?   Please visit the following link: Insert text file data into database
pls answer these question
pls answer these question  Write a program that prompts the user to input the length and width of a rectangle. Then calculate and prints the rectangle‚??s area and perimeter.   import java.io.*; class rectangle
pls send maven interview questions
pls send maven interview questions  pls send maven interview questions to anvesh2406@gmail.com
sourse code pls
sourse code pls  customer registration code in java?   Hello Friend, Please visit the following links: http://www.roseindia.net/jsp/javascriptpagerefresh.shtml http://www.roseindia.net/jsp/user-registration-form
on-line examination project?(urgent pls)
on-line examination project?(urgent pls)  Hello friends, i am doing an on-line examination project. In A page i will get n(user requirement) questions from data base(question and five radio buttons) if the user had
 

 

 

DMCA.com