|
-
September 22nd, 2015, 04:47 PM
#1
Multiplying a set number and a user input number
I'm trying to make a calculator that takes one number that I set and one number that the user inputs and multiplies them but I'm stuck. Everything is working fine so far but I'm not sure how to set my number and then have it interact with the user's number. Basically, I want to find out how many steps a person takes in the course of a minute, hour, ect using the data they enter. Here's what I have so far:
System.out.println ("Hello, my name is George. What is your name?");
String userName = userInputScanner.nextLine(); //Asks user name
System.out.println ("Hello," + userName + ". How many steps do you take in a ten second interval?"); //Greets user and asks first question
String stepsOne = userInputScanner.nextLine();
System.out.println("If you take" + stepsOne + "steps in a 10 second interval, you could potentially achieve...");
Also, when I display the code in Javac, there isn't any spaces between the "Hello" and the user's name so it comes out looking like HelloName. Fairly minor problem but if you know how to fix that, I'm all ears. Thanks.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|