Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer backup black screen blue screen boot bsod computer connection crash css dell driver drivers email error ethernet excel explorer firefox firefox 3 game hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook 2007 outlook express partition problem router slow software sound trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Java programming help


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
SpyKiller112's Avatar
Senior Member with 510 posts.
 
Join Date: Aug 2004
Experience: Intermediate
24-Sep-2007, 05:37 PM #1
Java programming help
Code:
/*Name: 
  Purpose: to convert miles and feet into inches
 */

import java.util.*;

public class inches
 {
   public static void main(String[] args)
	{

		Scanner keyboard = new Scanner(System.in);


		System.out.println("Enter distance in miles: ");
		int temp = keyboard.nextInt();
		int miles = (temp * 63360);
		System.out.println("The distance you entered in inches is: " + miles);

		System.out.println("Enter distance in feet: ");
		keyboard.nextInt();
		int feet = (temp * 12);

		System.out.println("The distance you entered in inches is: " + feet);
	}
 }
How do I make the number i'm entering appear on the same line as "Enter distance in miles?"
tomdkat's Avatar
Computer Specs
Distinguished Member with 3,705 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
25-Sep-2007, 02:50 PM #2
Don't use "println()", use "print()" instead.

Peace....
SpyKiller112's Avatar
Senior Member with 510 posts.
 
Join Date: Aug 2004
Experience: Intermediate
26-Sep-2007, 01:15 AM #3
Oh, and another quick nooby question.

Where do I insert the '\n' to make a new line between

"The distance you entered in inches is: " and "Enter distance in feet: "
tomdkat's Avatar
Computer Specs
Distinguished Member with 3,705 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
26-Sep-2007, 01:27 AM #4
Something like this:
Code:
System.out.print("\nEnter distance in feet: ");
should do the trick.

Peace...
SpyKiller112's Avatar
Senior Member with 510 posts.
 
Join Date: Aug 2004
Experience: Intermediate
26-Sep-2007, 01:32 AM #5
Thank you!... Worked like a charm!
tomdkat's Avatar
Computer Specs
Distinguished Member with 3,705 posts.
 
Join Date: May 2006
Location: S.F. Bay Area, CA
Experience: Intermediate
26-Sep-2007, 01:34 AM #6
Great! Could you mark this thread as "solved"?

Thanks!

Peace...
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 06:41 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.