java


How to prevent the enter from making a new line in console after input?


I'm using Scanner objects to get user inputs, but in the console after the enter key is pressed after the input, a new line is created. I just want it to jump to the next input area and not make a new line. Below is the output and after that is what happens after I press enter.
Please enter the number of residents in your house:
Please enter the area of the living space in square feet:
Please enter the Total monthly cost of internet:
Please enter the number of residents in your house: 5
Please enter the area of the living space in square feet:
Please enter the Total monthly cost of internet:
While the program does read the input, I have to manually use the arrow keys to enter the next one. Any help is appreciated. The actual code is below:
import java.util.Scanner;
//prints the House text-image
public class House{
public static void main(String[] args){
float monthlyInternet;
int numResidents, sqFeet;
Scanner sc = new Scanner(System.in);
System.out.println("Please enter the number of residents in your house: ");
System.out.println("Please enter the area of the living space in square feet: ");
System.out.println("Please enter the Total monthly cost of internet: ");
numResidents = sc.nextInt();
sqFeet = sc.nextInt();
monthlyInternet = sc.nextFloat();
System.out.println(" . _ _ _ _ _ .");
System.out.println(" / \\ _ _ _ _ _ \\");
System.out.println(" | | 0 0 |");
System.out.println(" |_| _ _ H _ _ |");
}//end main
}//end class

Related Links

sum(1/prime[i]^2) >= 1?
Sending Multiple Commands to device Through SSH
How to find pairs with product greater than sum
How do I write a regex in java which allow only numbers 0-9 and #
What are the benefits of using Generics? [duplicate]
How to remove < and > in XMLthat is part of the XML message
What steps are required to install eclipse on Windows8 (exitcode 13)?
Remaining tasks of Executor Service after timeout
Android SDK, action bar color
CRUD in Hibernate with one-to-many mapping
Components not appearing as intended with GridBagLayout
Java PreparedStatement, what to expect when the batchExecute does not have any parameter?
installing rJava error ubuntu 14.04
Coherence Delete Entry with regular expression
How do file paths work in a Dynamic Web Application in Java and Eclipse?
Java count each value of integer

Categories

HOME
google-chrome-extension
cloud
comparison
jsp-tags
rdf
append
facebook-messenger-bot
iggrid
google-translate
jplayer
caml
transformation
propel
text-rendering
oxyplot
ml
orleans
core-text
dxf
info.plist
nhapi
neo4j-spatial
assistant
objectanimator
preg-match-all
xquery-3.0
oracle-fusion-middleware
pim
perlin-noise
lxd
cloud-code
suricata
file-format
web-mining
hot-module-replacement
ensembles
elmah
paxos
dandelion
dtexec
sybase-asa
akka-cluster
android-fonts
android-textview
adxstudio-portals
google-web-starter-kit
bstr
skype4py
iad
browser-bugs
rake-task
jsonpickle
jscript.net
codeigniter-url
preferences
onactivityresult
braille
message-driven-bean
intentservice
apc
easy-install
eventual-consistency
sharp-repository
flashvars
specification-pattern
hamiltonian-cycle
multipage
cascalog
armcc
objective-c-2.0
windows-phone-7.1.1
assembly-loading
netdna-api
nsobject
jmock
visitor-statistic
asp.net-mvc-areas
zend-translate
dmx512
routedevent
fixed-width
webkit.net
eqatec
yagni
project-hosting
.net-1.0

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App