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","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};
int quantity[]={10,40,32,36,41};
boolean done = false;
public void nathan () throws IOException
{
InputStreamReader input = new InputStreamReader(System.in);
BufferedReader br=new BufferedReader(input);
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}}}}");
System.exit(0);
break;
default:
System.out.print("Wrong Info. Please Enter Again");
}
}
public void searchTitle()throws IOException
{
System.out.print("Enter Title Name::");
String name = br.readLine();
int title = Integer.parseInt(op);
switch(title)
{
case "Biography":
System.out.println("\t Title\t\tAuthor\t\tPublisher\tQuantity\tPrice");
System.out.println("\t =============================================");
System.out.println("");
System.out.println("\t "+title[i]+"\t"+author[i]+"\t\t"+publisher[i]+"\t\t"+quantity[i]+"\t\t"+price[i]);
break;
case "Computers":
System.out.println("\t Title\t\tAuthor\t\tPublisher\tQuantity\tPrice");
System.out.println("\t =============================================");
System.out.println("");
System.out.println("\t "+title[i]+"\t"+author[i]+"\t\t"+publisher[i]+"\t\t"+quantity[i]+"\t\t"+price[i]);
break;
case "Science":
System.out.println("\t Title\t\tAuthor\t\tPublisher\tQuantity\tPrice");
System.out.println("\t =============================================");
System.out.println("");
System.out.println("\t "+title[i]+"\t"+author[i]+"\t\t"+publisher[i]+"\t\t"+quantity[i]+"\t\t"+price[i]);
break;
case "Sports":
System.out.println("\t Title\t\tAuthor\t\tPublisher\tQuantity\tPrice");
System.out.println("\t =============================================");
System.out.println("");
System.out.println("\t "+title[i]+"\t"+author[i]+"\t\t"+publisher[i]+"\t\t"+quantity[i]+"\t\t"+price[i]);
break;
case "Religion":
System.out.println("\t Title\t\tAuthor\t\tPublisher\tQuantity\tPrice");
System.out.println("\t =============================================");
System.out.println("");
System.out.println("\t "+title[i]+"\t"+author[i]+"\t\t"+publisher[i]+"\t\t"+quantity[i]+"\t\t"+price[i]);
break;
default:
System.out.print("DIDT FOUND");
}
}
public void purchase()throws IOException
{
System.out.print("Enter book name:");
String name = br.readLine();
int title = Integer.parseInt(op);
switch ("")
{
case 1:
System.out.println("\torder details are as follows:");
System.out.println("\t============================");
System.out.println("");
System.out.println("\tBook title:"+title[i]);
System.out.println("");
System.out.println("\tAuthor:"+author[i]);
System.out.println("");
System.out.println("\tPublisher:"+publisher[i]);
System.out.println("");
System.out.println("\tUnit Price:"+price[i]);
System.out.println("");
System.out.println("\tQuantity:"+qua1);
System.out.println("");
System.out.println("\tTotal:"+total);
System.out.println("");
System.out.print("Thank you");
break;
default:
System.out.print("Book not found");
}
}
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("");
}//end of allbooks
public static void main(String args[])throws IOException
{
nathan bk = new nathan();
bk.nathan();
}
}
View Answers
May 1, 2010 at 11:20 AM
Hi Friend,
Try the following code:
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();
}
}
Thanks
Related Tutorials/Questions & Answers:
hi.. i hv few error. pls. - Java Beginnershi..
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...("");
System.out.println("\t "+title[
i]+"\t
Advertisements
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
ModuleNotFoundError: No module named 'hv'ModuleNotFoundError: No module named '
hv'
Hi,
My Python program is throwing following
error:
ModuleNotFoundError: No module named '
hv'
How to remove the ModuleNotFoundError: No module named '
hv'
error ModuleNotFoundError: No module named 'hv'ModuleNotFoundError: No module named '
hv'
Hi,
My Python program is throwing following
error:
ModuleNotFoundError: No module named '
hv'
How to remove the ModuleNotFoundError: No module named '
hv'
error pls i need help with my assignmentpls i need help with my assignment how to write a code that ask the user for the height of the triangle and prints the triangle using * eg if height is 3 it prints
*
and also using import java.util.Scanner
how can i get output pls urget tell mehow can
i get output
pls urget tell me HTTP Status 500 -
type Exception report
message
description The server encountered an internal
error () that prevented it from fulfilling this request.
exception
I GOT ERROR FOR MY PROJECTI GOT
ERROR FOR MY PROJECT Dear Friend/ RoseIndia Team,
Firstly
I would to thank u Guys help me so many time..
I got
error on my little project when running at server.
please correctly my
error Guys...
ERROR CODE:
"LOGIN
Hi ..I am Sakthi.. - Java BeginnersHi ..
I am Sakthi.. can u tell me Some of the packages n Sub Directories starts with...
import javax.swing.*;
import javax._________;
...;
Hi friend,
package javacode;
import javax.swing.*;
import
I/O Program output errorI/O Program output error Hello All,
I am working on a program... file, but
I am getting incorrect output.
I have been successfull with part of the program in that it reads the text file and analyzes it, however
I need it to take
hi hi on clicking on button on 1st jsp page
i want to display following options like friends,family,doctor etc.on next jsp page and also
i want link... databases like the above i.e friends,family,etc
pls can any one tell how can
i do
hi hi on clicking on button on 1st jsp page
i want to display following options like friends,family,doctor etc.on next jsp page and also
i want link... databases like the above i.e friends,family,etc
pls can any one tell how can
i do
hihi how
i get answer of my question which is asked by me for
few minutes ago.....rply
ModuleNotFoundError: No module named 'FEW'ModuleNotFoundError: No module named '
FEW'
Hi,
My Python program is throwing following
error:
ModuleNotFoundError: No module named '
FEW'
How to remove the ModuleNotFoundError: No module named '
FEW'
error Jsp error when i run this a jsp fileJsp
error when
i run this a jsp file
hi
I got this
error when
i run the jsp file in IDE and outside also
please help me
java.lang.NullPointerException
org.apache.jsp.insertjsp.jspInit(insert_jsp.java:22
Hi i am new to J2ee Technology and struts - StrutsHi i am new to J2ee Technology and struts what exatly will happen when we hit the Login button? Once we enter in to the application, what will happen. How the UserID and Password validations will done. Can any one help
i am unable to identify the error in my codei am unable to identify the
error in my code class Program
{
public static void main(String[] args)
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter
i am unable to identify the error in my codei am unable to identify the
error in my code class Program
{
public static void main(String[] args)
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
System.out.println("enter
hi hi I have connected mysql with jsp in linux and
i have used JDBC connectivity but when
i run the program, its not working the program is displaying
HiHi
Hi All,
I am new to roseindia.
I want to learn struts.
I do not know anything in struts. What exactly is struts and where do we use it. Please help me. Thanks in advance.
Regards,
Deepak
hi num=4;
int p = num;
int
q = 0;
for (int
i = 0;
i <= num;
i++) {
for (int j = p; j>= 1; j-- )
System.out.print(" ");
p-=1;
for (int k = 1; k <=
i; k...
*
* *
* * *
* * * *print("code sample");
Hi Friend,
Try
HiHi
I want import txt fayl java.please say me...
Hi,
Please clarify your problem!
Thanks
hi hi i want to develop a online bit by bit examination process as part of my project in this
i am stuck at how to store multiple choice questions options and correct option for the question.this is the first project
i am doing
hionline multiple choice examination
hi i am developing online multiple choice examination for that
i want to store questions,four options,correct answer in a xml file using jsp or java?can any one help me?
Please
hi!hi! how can
i write aprogram in java by using scanner when asking... to to enter, like(int,double,float,String,....)
thanx for answering....
Hi...);
System.out.print("Enter integer: ");
int
i=input.nextInt
ModuleNotFoundError: No module named 'pls'ModuleNotFoundError: No module named '
pls'
Hi,
My Python program is throwing following
error:
ModuleNotFoundError: No module named '
pls'
How to remove the ModuleNotFoundError: No module named '
pls'
error ModuleNotFoundError: No module named 'pls'ModuleNotFoundError: No module named '
pls'
Hi,
My Python program is throwing following
error:
ModuleNotFoundError: No module named '
pls'
How to remove the ModuleNotFoundError: No module named '
pls'
error ModuleNotFoundError: No module named 'pls'ModuleNotFoundError: No module named '
pls'
Hi,
My Python program is throwing following
error:
ModuleNotFoundError: No module named '
pls'
How to remove the ModuleNotFoundError: No module named '
pls'
error hi.......hi....... i've a project on railway reservation...
i need to connect netbeans and mysql with the help of jdbc driver... then
i need to design the frame... aftr clickg run
i need to enter data to ma frame and the data which
i hihi sir i've a project on railway reservation...
i need to connect netbeans and mysql with the help of jdbc driver... then
i need to design the frame... aftr clickg run
i need to enter data to ma frame and the data which
i enter
hihi sir i've a project on railway reservation...
i need to connect netbeans and mysql with the help of jdbc driver... then
i need to design the frame... aftr clickg run
i need to enter data to ma frame and the data which
i enter
HiHi The thing is
I tried this by seeing this code itself.But
I;m facing a problem with the code.Please help me in solving me the issue.
HTTP Status... an internal
error () that prevented it from fulfilling this request.
exception
Hi Hi I need some help I've got my java code and am having difficulty to spot what errors there are is someone able to help
import java.util.Scanner;
public class Post {
public static void main(String[] args) {
Scanner sc
hi..hi..
I want upload the image using jsp. When
i browse the file then pass that file to another jsp it was going on perfect. But when
i read...);
for(int
i=0;i<arr.length-1;
i++) {
newstr=newstr