Home Discussion Discuss: Change the user input to integer

  • Error on that ExampleMurugan.M June 27, 2011 at 2:33 AM

    Though the concepts were correct, When I tried that program it showed me the error D:\ecom\java\bin>javac EnterValuesFromKeyboard.java D:\ecom\java\bin>java EnterValuesFromKeyboard Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at EnterValuesFromKeyboard.main(EnterValuesFromKeyboard.java:14) how can you solve this ERROR?

  • Java Program-Progress ReportBinnu Jesudasan Gudapati July 29, 2011 at 10:42 AM

    import java.io.*; public class Progress_Report { static public void main(String args[])throws IOException { int i,j,count=0; int marks[]=new int[7]; float avg; BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); for(i=1;i<=3;i++)//No Of Students { int total=0; System.out.println("Enter Marks Of One Student "+i); for(j=1;j<=6;j++)//No Of Subjects { System.out.println("Enter The Marks Of Subject "+j); marks[j]=Integer.parseInt(br.readLine());//Here its denying input less than three digit total=total+marks[j]; while(marks[j]<35) { count=count+1;//No Of Failed Subjects } } avg=(total/6); System.out.println("Total Of Student "+i+" is "+total); System.out.println("Average Of Student "+i+" "+avg); System.out.println("No Of Subjects Failed "+count); } } } Thanks In Advance....Hope You Reply Me Fast....Mail Me : binnujesudasan@gmail.com

  • parseInt().sumudu April 18, 2012 at 9:52 AM

    thanx dear

  • javachinnu July 4, 2012 at 1:51 PM

    wen i executed dis program, i got an error tat is "exception in thread "main" java.lang.ArrayIndexOutOfBoundsException"... why it is showing error like dat ??? pls explain dis..

  • Exceptionmari September 12, 2012 at 8:35 PM

    Hi, I'm only a beginner at Java. Running the program as it is given in the example, I get an exception (here after). Can you explain me why please? Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 at EnterValuesFromKeyboard.main(EnterValuesFromKeyboard.java:14)

  • in switch statementgaddaffi December 2, 2013 at 5:06 PM

    how do we use integer.parseint in switch statement. boss?

Post your Comment



Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Related Articles
Java Beginners

accept integer from user
accept integer from user  Write an Java application that accepts 100 integer numbers from a user. The input should be in the range of 1-200. Error message needs to be displayed if user entered input which is not in this range 

Java Tips and Examples

Change the user input to integer
Change the user input to integer   ... is in integer but it will be interpreted as a String so, we have to change the string... will create a object of a Rectangle class. Now we ask the user to input two values 

Java Beginners

Managing Multiple User Input Data in an Array (or ArrayList)
Managing Multiple User Input Data in an Array (or ArrayList)  Hey... record alphabetically (2) If user chooses choice1, the input data is stored in an ARRAY (or ARRAYLIST) until the user chooses to stop inputting data. Kindly 

General

Integer exception in java
the character input stream. The program will ask the user to enter the number , if the user enter the number other than integer it will gives an exception error. if the user enters integer it will display the number which the user have 

Java Beginners

find the given input is integer or string
find the given input is integer or string  simple coding for to check the given input value is integer or no.If the given value is integer display "Value is integer" otherwise "Value is not a integer"?   class 

Java Beginners

input
input  a java program that will exchange the last names of two students that were input by a user 

PHP Questions

escaping user input in php
escaping user input in php  Is it possible to escape the user input while submitting data into database in PHP 

Java Beginners

Java User Input
Java User Input  I am using Scanner class for user Input. Scanner s = new Scanner(System.in); String name = s.next(); but i am unable to store full name in name variable...how i can store full name plsss reply   use 

Applet Questions

user input to database
user input to database  /* * Studentinfo2App.java */ package studentinfo2; import java.sql.Connection; import java.sql.DriverManager; import... in my database user input from my applet does not show 

Applet Questions

user input to database
user input to database  /* * Studentinfo2App.java */ package studentinfo2; import java.sql.Connection; import java.sql.DriverManager; import... in my database user input from my applet does not show 

Applet Questions

user input to database
user input to database  /* * Studentinfo2App.java */ package studentinfo2; import java.sql.Connection; import java.sql.DriverManager; import... in my database user input from my applet does not show 

Applet Questions

button to accept user input
the radiobutton and spinner.The user input does not show on my Studentinfo.mdb...button to accept user input  private void jButton1ActionPerformed... that accepts firstname, lastname and gender from user and insert to database 

Java Beginners

ask a user to enter 5 integer
ask a user to enter 5 integer  make a program that enter 5 numbers then identify the largest and the smallest number sample program 2 4 3 5 6 the smallest number: 2 the largest number: is 6 66 

Java Beginners

calculation after if. user input
user input????   My apologies good evening peoples Once again I am...calculation after if. user input  System.out.print ("please select...[]args){ Scanner input=new Scanner(System.in); System.out.print 

Java Code Examples

Java Reverse integer array
Java Reverse integer array In this tutorial, you will learn how to reverse integer array. Here, we have created a method to reverse an array which has been... order. In the main method, we have allowed the user to enter numbers 

JDBC Questions

retreive integer data from database
retreive integer data from database  i made a table named result... and two buttons "ok" and "cancel" i want to take input from textfield as an integer(rollno) and the marks associated with that must be displayed.i write 

EJB Questions

Input in Stateless Bean - EJB
Input in Stateless Bean  Hello, I am having problem in taking the input in stateless bean, when I am trying to get integer or double type input from the user in the client file, It shows me the error 

Java Beginners

integer to string
integer to string  i have to develop a program which convert integer into character from 1 to 10,000 if we input 1 then it give output 'one' n so on till 'ten thousand' kindly give me the codes plzplz sir........   Have 

Development process Questions

How to read user input in C++
How to read user input in C++  How can i get an input from the users in C++?   You can use the standard input "cin" to get the input from user.. For example: int age; cin >> age 

Java Beginners

java program (integer/decimal) - Java Beginners
java program (integer/decimal)  Accept a number from the user as command line arguments. The number could be an integer or decimal value. ? Display the absolute value of the input number ? Display the rounded off value 

Java Beginners

java user input - Java Beginners
java user input  how to input from keyboard? please give a example.  Hi Friend, There are lot of ways to input data from keyboard.You...:****** try{ System.out.print("Enter String:"); BufferedReader input = new 

Java Beginners

user input in java - Java Beginners
user input in java   i am trying to write a code to compute the average of 5 numbers but i dont know what to do for the program to accept user input  Hi import java.util.*; public class AverageExample { public 

Java Beginners

error in taking input from user.
error in taking input from user.  //i m having problem inputting the array from user.my program is import java.io.*; class bubble { public static void main(String args[]) { int a[]=new int[20]; int i=0; BufferedReader br=new 

General

Java get User Input
Java get User Input       In this section, you will learn how to get the user input from... that will communicate with the user at the command line and returns the user input. We have 

Swing AWT

How to take input by user using jDialogue and use that input
How to take input by user using jDialogue and use that input  I am using NetBeans i have a 'Search by employee id' button . I want when user click this button a dialogue box appear which take employee_id as input from user 

Java Beginners

XP Bowling Game User input help
XP Bowling Game User input help  I was asked to do the XP Bowling Example as an assignment. I have the programme passing all tests, but now I need to make the code accept input from a user and display the scores/frames 

JDBC Questions

Save the input data until user get changed
Save the input data until user get changed  I would like to know how to store the give input data and perform the calculations even after re-opening... know how to change the fine amount and store for a day by the ADMINISTRATOR 

JDBC Questions

Save the input data until user get changed
Save the input data until user get changed  I would like to know how to store the give input data and perform the calculations even after re-opening... know how to change the fine amount and store for a day by the ADMINISTRATOR 

JDBC Questions

Save the input data until user get changed
Save the input data until user get changed  I would like to know how to store the give input data and perform the calculations even after re-opening... know how to change the fine amount and store for a day by the ADMINISTRATOR 

Java Interview Questions

Write a program that takes the marks of user as input
Write a program that takes the marks of user as input  Write a program that takes the marks of user as input. If marks are greater then 60 the program should display "Great, you have passed the course", else the program should 

DMCA.com