Accepting Imut from the user keyboard
Is this the only way of accepting an input from the user via a keyboard or is there an easier way ?
Thanks.
import java.io.*;
public class Greetings
public static void main(String[] argv) throws IOException
// Keyboard Input
BufferedReader b = new BufferedReader(new InputStreamReader(System.in));
// Declare Variables
String UserName;
// Accept User Name
System.out.println("What is your Name?");
UserName = b.readLine();
}
Personally I always use the gui counterpart JOptionPane.showInputDialog()
Similar Messages
-
Change this code to accept the grades from the user..
how I will change this code
package regradesaverage;
public class ReGradesAverage {
* @param args the command line arguments
public static void main(String[] args) {
int[] array = {87,68,94,100};
int total = 0;
for (int counter = 0; counter < array.length; counter++)
total += array[counter];
System.out.printf("Total sum of Grades : %d\n", total);
System.out.printf("The Grade Average is: %d\n", total/array.length);
} to accept the grades from the user
I need to create a method called "average" that takes has an array of strings as a parameter and returns double.893973 wrote:
I need to create a method called "average" that takes has an array of strings as a parameter and returns double.Exactly, you need to create a method.
You're the one in school doing the assignment, so you can't just unload your homework here.
If you want help, show us what you've tried and what you're having problems with. -
How to create a program that accepts 5 digits from the user between 0 and 9
how to create a program that accepts 5 digits from the user between 0 and 9 then put them in ascending order using link-list method..
You can use a scanner to get user input from the command line.
import java.util.*;
public class Test {
private List<Integer> list;
private Scanner in;
public static void main (String... args) {
new Test ();
public Test () {
list = new LinkedList<Integer> ();
in = new Scanner (System.in);
for (int i = 0; i < 5; i ++) {
System.out.format ("Please enter a number (%d more): ", (5 - i));
list.add (in.nextInt ());
Collections.sort(list, new Comparator<Integer> () {
public int compare (Integer i1, Integer i2) {
return i2 - i1;
System.out.println (list);
} -
I can't restore my user account from the users screen because I get an alert that Mac OS needs something. I can't restore in TimaeMachine from the Admin screen because I can't see other users home folders. What can I do?
See Pondini's TM FAQs for starters.
-
How to get a formula from the user from a text box in a webpage
Hi. I would like to know how to get the formula from the user who enters in a textbox. This formula can have any number of variables starting with a and goes on.
The complexity of the formula can go upto sin, cos, ln, exp. Also user enters the minimum and maximum values of these variables. Based on a specific algorithm (which I use) I would calculate a *set of values, say 10, for each of these variables, substitute in the formula and based on the result of this formula, I select ONE suitable value for each of the variables.
I don't know how to get this formula (which most likely to be different each time) and substitute the values *which I found earlier.
Kindly help me out in this issue.
ThanksThe textbox is the easy part. It's no different than getting a String parameter out of an HTTP request.
The hard part is parsing the String into a "formula" for evaluation. You'll have to write a parser or find one.
Google for "Java math expression parser" and see what you get.
Or write your own with JavaCC.
% -
I want to set the value of "Keep the following number of major versions" in the versiong settings of a documnet library to a limit say 20 and then disable the option from the users so that they cannot them. Is it possible thorugh some custom coding?
Hi Moumita10,
Just curious about that how the custom CSS code works in your environment if put it in the “LstSetng.aspx” page.
In my environment, it hides the "Keep the following number of major versions" setting in the “LstSetng.aspx”
page after applying the custom CSS style there.
Thanks
TechNet Community Support
Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
I have moved my iTunes library to a new Windows 7 PC and cannot transfer music from the new iTunes PC to my iPhone 4S. The iPhone will only accept music transfers from the original iTunes PC. I have come to understand that an iPhone can have only one "daddy" iTunes PC, but have not been able to find out how to change the "daddy". I have done a backup of the iPhone, and a "Restore to Original Settings". Then I restored the content using the new iTunes PC. My Apps and contacts, etc. are back on the iPhone, but it still won't accept music from the new iTunes PC.
What happens when you try to sync the iphone to the new computer?
-
How do i get input from the user?
For example if i wanted to ask "Whats your favorite number" and then get the input from the user and assign it to a variable how would i go about doing that?
hi,
if you want to get input from your console your should work with io(input and output).The BufferedReader class, InputStreamReader class
you should import "java.io.BufferedReader" and "java.io.InputStreamReader" package, and do something like this:
BufferedReader input = new BufferedReader(new InputStreamReader(System.in));
String favoriteNumber;
System.out.println("Whats your favorite number ");
favoriteNumber = input.readLine();
System.out.println ("Your favorite Number Is " + favoriteNumber);
if its a gui you should import "javax.swing.JOptionPane" and do the following
String favoriteNumber = JOptionPane.showInputDialog(null, "Enter your favorite Number", "Favorite Number", JOptionPane.INFORMATION_MESSAGE);
anjiie([email protected]). -
Prvent from the user deleting specific line in view table
HI,
In our Project we have a View Table which user can maintain ,
the user can change or delete the line (and fields) in this table.
what i want is for one line for specific combination in the table to prevent from the user to delete this line ,
so when he push on change mode and mark the line and push on delete i want to give him a error message that he can't delete this line (because the specific combination ).
i new for the concept of the PBO PAI....
so i appreciate any help or suggestions.
Best regards
Micheal A[Table maintenance Events|http://www.google.com/url?sa=t&source=web&ct=res&cd=4&url=https%3A%2F%2Fwww.sdn.sap.com%2Firj%2Fservlet%2Fprt%2Fportal%2Fprtroot%2Fcom.sap.km.cm.docs%2Flibrary%2Fabap%2FHow%2520to%2520implement%2520Events%2520in%2520Table%2520Maintenance.doc&ei=txFUSdKHKISeNbG1_dQP&usg=AFQjCNF3AI-77PC-MS20vx-ARd4a6zxUfg&sig2=Y_IWbHOsETvyoIrFzPxpCg]
[SAP help|http://help.sap.com/saphelp_erp2005vp/helpdata/en/91/ca9f0ea9d111d1a5690000e82deaaa/content.htm] -
Dynamic Picking of Org. Unit ID (Root) from the User Responsible!
Hi All,
We are implementing Nakisa 3.0 SP1 for our client. I do know, that we need to configure Root Org. Unit ID under 'General Settings' under 'Administrator Console'. This helps Nakisa to show Org. Structure starting from Root Org. ID configured.
However, we have multiple Talent Administrators responsible for different Organization Levels. Hence, we dont want to fix (or hardcode) root org. id in configuration. Instead we want system to pick Root Org. Unit ID from the USer who has looged based on 741 relationship in the backend (HRP1001).
I have no clue how to achieve this? Please Help!
Thanks,
PrashantHi Luke,
Employee is attached to a position.
We are trying with login screen as well. But something is going wrong & it is not allowing us to login with user ID & Password (with which we are able to log in to other components of nakisa successfully).
Below is the error message whichw e are getting in log file:
295. 07 Jul 2011 09:01:06 INFO com.nakisa.Logger - com.nakisa.framework.login.Main : LogIn : Login process finished with errors
296. 07 Jul 2011 09:01:32 INFO com.nakisa.Logger - Tenant ID: 000
297. 07 Jul 2011 09:01:32 INFO com.nakisa.Logger - LoginSettingsObject Load: 14
298. 07 Jul 2011 09:01:32 INFO com.nakisa.Logger - com.nakisa.framework.login.Main : LogIn : Credential provider ActiveDirectory
299. 07 Jul 2011 09:01:32 INFO com.nakisa.Logger - com.nakisa.framework.login.Main : LogIn : User to authenticate chouhas
300. 07 Jul 2011 09:01:32 INFO com.nakisa.Logger - com.nakisa.framework.login.Main : LogIn : Authentication provider SapStandard
301. 07 Jul 2011 09:01:32 INFO com.nakisa.Logger - com.nakisa.framework.login.Main : LogIn : User authenticated chouhas
302. 07 Jul 2011 09:01:32 INFO com.nakisa.Logger - com.nakisa.framework.login.Main : LogIn : Authentication row is null
303. 07 Jul 2011 09:01:32 INFO com.nakisa.Logger - com.nakisa.framework.login.Main : LogIn : User population provider is Database
304. 07 Jul 2011 09:01:32 INFO com.nakisa.Logger - FunctionRunner.executeFunctionDirect: /NAKISA/RFC_REPORT threw an Exception of type Exception, took: 27ms
305. 07 Jul 2011 09:01:32 ERROR com.nakisa.Logger - BAPI_SAP_OTFProcessor_Report : Utility.generateTableFromJoinConds() : while trying to read the field 'name' of an object loaded from an array (which itself was loaded from local variable 'FJC') with an index loaded from local variable 'i'
Please Help!
Thanks,
Prashant -
How to get data from the user for an Insert Trigger ?
Hi all and thanks in advance, I need to get some values from the user for a child table when a row inserted into the parent table, is that possible to use ampersand inside an "Insert Trigger" to let the user for inserting some values ?
Edited by: user9942078 on 17-Dec-2008 16:35In a different words,
When a virus attacked your body your blood cells instantly goes into operation. Just like that -> your trigger activated as a result of your DB operation on objects. So, here also you have no option to manually intervene anything.
Hmm... Looks like some science fiction movies ultimately pays some price... ;)
So, trigger basically fires implicitly as a result of any database operation on objects or even on user.
So, that has to be automatic. And, when you are using & it will ask for some input value - which cannot be done in case of triggers.
For details please refer the oracle docs.
Regards.
Satyaki De. -
Best way to create a conact list from the user profile properties
We have a customer looking for a phone book utility, starting with a table showing main user information and with some search options. We would like o base it on the user profile properties and not to create an indipendent studion record browser porlet.
What is best way to create a conact list from the user profile properties ?I did something like this using search. It can get messy, so you need to take care with it.
* Identify the properties you want to make accessible to search (ex: name, etc.)
- add them to the user property map
- flag them as searchable
* I broke down and used the native server API. I'd still suggest this approach.
* Write some simple code to do vcard export if you like
(my code is all in vb.net)
I really believe this is the "right" approach, but honestly, this was a bit painful and has been
messy for us given some other business issues. (to my chagrin we have users with 2-letter last
names...)
I have code you're welcome to poke at, but it's more or less slapped together and has various
different search methods commented out so you can see how I tinkered w/ the remote vs. server
API.
If you'd like it mail me at [email protected] and I'll send you a zipped copy w/ a
readme. I hope it may be useful to you as both a starting reference. -
Is there a method of deleting the developer key from the user?
Is there a method of deleting the developer key from the user?
Please help me.Hi Matt,
Could you explain from which table should be deleted..?
Thanks.
Regards,
Ramses Hutahaean -
Receiving an error when trying to remove P00 Security role from the user
Hi All,
I am receiving an error when trying to remove P00 Security role from the user.
After logging on to GRC CUP, clicking on u201CCreate requestu201D, and filling out required information,
I click on Select Roles/Groups
On the next screen,
I click on Existing Roles/Groups
ERROR MESSAGE appears X Action failed and no roles appear in the box to select for removal.
Regards,
VineetHi Vineet,
My be your selection is incorrect
Try this
in Applicaiton Area -- Select ALL
Functional Area -
Select ALL
Company -
Select ALL
Role/Profile/Group Names --- Give p00* and execute the report
if you give only p00 it wont give any result
Hope this helps
Thank you,
Kishore -
How to execute BAPIs by getting the input from the user through the browser
Hi,
I have created a simple xMII transaction using BAPI. It is a simple BAPI with one input. Now i want the transaction to be executed by getting the input from the user through browser. Once the user enters the value and clicks on a button, I want the result of the BAPI to be displayed in the grid. How to link the BAPI/transaction with applet/Javascript coding.
Thanks.The first thing I would recommend would be for you to collaborate with your colleague Vinodh, since his/her recent thread is very similar to yours: Calling a BAPI from web page
In your case, the iGrid applet will run the Xacue query template and automatically display the results from your output parameter.
I would encourage you to take a look at the sticky thread at the top of the forum entitled "MII Manufacturing Templates Updated" since this MII project is full of samples for you and your colleague to learn from.
Maybe you are looking for
-
Hi All we are trying to develop a report for fully cleared AR items currently, as per the process, we have an open invoice from billing, then we receive an on account payment which we record thru F-26 without matching it to any invoice. After which,
-
Lightroom 5 Adjustment Brush Problem?
When I want to use my adjustment brush, I do not have the second circle show up to show where it has taken the adjustment from the photo. Is there a way to fix this? I was able to use it before and didn't have a problem. But I haven't used the progra
-
HT4859 problem turning on phone there was a problem turning on your email. try again
I am getting a message "problem turning on phone there was a problem turning on your email. try again"
-
Payed for subscription, but Muse CC doesn't work, it asks me serial number
payed for subscription, but Muse CC doesn't work, it asks me serial number, any help?
-
How to retrieve cr2 files on iMac
I have Uploaded canon cr2 files from iPad to iCloud via photo stream. Unfortunately my iPad was restored. how do I retrieve the original cr2 files on my iMac?