Home Answers Viewqa Java-Beginners user input in java

 
 


towera
user input in java
1 Answer(s)      5 years and a month ago
Posted in : Java Beginners

View Answers

May 17, 2008 at 6:13 PM


Hi

import java.util.*;

public class AverageExample {
public static void main(String[] args) {
double number;
int count = 0;
double total = 0;
Scanner scan = new Scanner(System.in);
System.out.println("Type some numbers, " + "the last one being 0");
number = scan.nextDouble();
while (number != 0) {
total = total + number;
count = count + 1;

number = scan.nextDouble();
}
System.out.print("The average of the ");
System.out.print(count);
System.out.print(" numbers is ");
System.out.println(total / count);
}
}


----------------------------------

read for more information.

http://www.roseindia.net/jsp/









Related Pages:
input
input  a java program that will exchange the last names of two students that were input by a user
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
button to accept user input
the radiobutton and spinner.The user input does not show on my Studentinfo.mdb database it just gives me an error.please help   Here is java swing example...button to accept user input  private void jButton1ActionPerformed
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
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 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
XP Bowling Game User input help
XP Bowling Game User input help  I was asked to do the XP Bowling... to make the code accept input from a user and display the scores/frames in a command window. Being new to Java....I have no clue how to out put it to the console
Keyboard Input
Java NotesKeyboard Input There are two approaches to getting keyboard input from the user. GUI (Graphical User Interface). Displaying a graphical text... of the old Teletype machine. Java was designed for graphical user interfaces (GUI
input output
; Introduction The Java I/O means Java Input/Output and is a part... input to read the user input.. In this section, you will see how the standard I... DataInputStream A data input stream is use to read primitive Java data types from
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
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
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
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
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
input - Java Beginners
input  i want to know how to take value from user in core java.help me soon.  Hi Friend, There are lot of ways to input data.You can use... to input the data from the command prompt. Try the following code to input name
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
Dialog and Console Input-Output
, but it also gets input from the user. 1 2 3 4 5 6 7 8... that also accepts user input. It returns a string that can be stored... and file input. Of course, your program should eventually have a GUI user
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
Input And Output
; Introduction The Java I/O means Java Input/Output and is a part of java.io... standard input to read the user input.. In this section, you will see how... DataInputStream A data input stream is use to read primitive Java data types from
Servlet Error Message based on user input
Servlet Error Message based on user input   ... to check the user input against database and display the message to the user. This example illustrate how to ensure that user input is correct by validating
Change the user input to integer
Change the user input to integer   ... will create a object of a Rectangle class. Now we ask the user to input two values... for an input, then we should use Integer.parseInt(string str).  As we know
Dialog Box Input Loop
Prev: Example: Capitalize | Next: Java NotesDialog Box Input Loop... When reading input in a loop user must have some way of indicating that the end... of the input is for the user to enter a special value to indicate
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
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 the program. I am developing a college library management system, i would like
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 the program. I am developing a college library management system, i would like
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 the program. I am developing a college library management system, i would like
Java Graphical user interface
Java Graphical user interface  Hi, guys. I'm christina, need help with my home work Task 1: GUI Design and Implementation The user requirements of your Java quiz GUI application are specified by the following program flow
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
input box
input box  give me the code of input box in core java
input box
input box  give me the code of input box in core java
Simple input application in Echo3
an application which contains the window from where the user can  input a text and this value would be shown into the content pane when user will click... Simple input application in Echo3   
How to get the unicode of japanese character input in java
How to get the unicode of japanese character input in java  Good Evening sir/madam; I am trying to create an application in java which needs to show... the user to check their vocabulary.But I stuck in the middle coz if user enters
Show input dialog box
anything from user. Java Swing provides the facility to input any thing (whether... Swing Input Dialog Box Example - Swing Dialogs       Input dialog box is very important
Console Input: Scanner
Java NotesConsole Input: Scanner The java.util.Scanner class (added in Java 5) allows simple console and file input. Of course, your program should eventually have a GUI user interface, but Scanner is very useful for reading data
Array and input
[ ]={1,2,3,4,5,6,7,8,9,10,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26}; i want to ask user to input one of the above numbers then i want to print the array without the number user input. how will i do tht
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
Command Line Standard Input In Java
Command Line Standard Input In Java In this section we will discuss about the Java IO Standard Input through Command Line. Standard streams, feature of various O/S, are read through standard input in Java. Standard streams are read
input output
input output  java program using fileinputstream and fileoutputstream   Hi Friend, Try the following code: import java.io.*; class FileInputStreamAndFileOutputStream { public static void main(String[] args
input output
input output  java program using fileinputstream and fileoutputstream   Hi Friend, Try the following code: import java.io.*; class FileInputStreamAndFileOutputStream { public static void main(String[] args
User Interface Toolkits
boxes etc and also dealing user input via those components. Swing The Swing...User Interface Toolkits User Interface Toolkits / Libraries are given below : Input Method Framework In entering text, this Framework make possible
how to transliterate the input from english to japanese
how to transliterate the input from english to japanese  Hi everyone , I am trying to make an application in java in which i want to get input from user and want to transliterate it in japanese for example : if user types "sa
How to prompt user
How to prompt user  Dear Sir, I'm a new student, a beginner in Java. Pls help to write program as below :- a)to prompt user to input 2 integers...[] args) throws Exception{ Scanner input=new Scanner(System.in); int
Updating user profile
Updating user profile  how should i provide user to update his profile with edit option including entered data by user should be shown in jsp page.... When the user clicks the particular edit button, that data will get shown
Java User-defined Exception
Java User-defined Exception In this tutorial, you will learn about the User... to handle errors in the applications with customized responses. It creates the java application more user friendly and easily understood. The given example throw
How to create file from input values in Jframe ?
How to create file from input values in Jframe ?  hi i m doing my project using java desktop application in netbeans.i designed a form to get the user's academic details and on clicking the submit button,it displays all
Java Command Line Input
Java Command Line Input  How to get input from command line in java... System.out.println("Please Input A Number"); BufferedReader br... this code you will find the output as Please Input A Number 2 data is- 2
different type input in java
type of input method. thank   Java Read through DataInputStream: import...); } }   Java read input through Scanner: import java.util.*; class...); } }   Java read input through BufferedReader import java.io.*; public class
java input problem - Java Beginners
java input problem  I am facing a Java input problem
input output in java
input output in java  java program using filereader and filewriter   Hi Friend, Try the following code: import java.io.*; class FileInputStreamAndFileOutputStream { public static void main(String[] args) throws
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

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.