944,033 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 2072
  • Java RSS
Sep 7th, 2006
0

Java 5 with Mac OS X

Expand Post »
I'm new to java and i am trying to make the scanner function work, but it won't. I have the latest version of java and Mac OS X

This is the info on the version that terminal gave me:
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-112)
Java HotSpot(TM) Client VM (build 1.5.0_06-64, mixed mode, sharing)

I compiled this program with jEdit and it reports no errors. But when I run it it gets stuck in a loop.


import java.util.Scanner;

public class Payroll
{
public static void main(String[] args)
{
String name;
int hours;
double payRate;
double grossPay;

Scanner keyboard = new Scanner(System.in);

System.out.print("What is your name? ");
name = keyboard.nextLine();

System.out.print("How many hours do you work a week? ");
hours = keyboard.nextInt();

System.out.print("What is your hourly wage? ");
payRate = keyboard.nextDouble();

grossPay = hours * payRate;

System.out.println("Hello" + name);
System.out.println("Your gross pay is $" + grossPay);
}
}

Please Help
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
munsonpm is offline Offline
2 posts
since Sep 2006
Sep 8th, 2006
0

Re: Java 5 with Mac OS X

works fine (except for the error you made in the calculation routine). Question is, do you know how to use the program you wrote?
How do you expect it to work?
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Sep 8th, 2006
0

Re: Java 5 with Mac OS X

I found out that jEdit's plugin doesn't work with macosx. I tried a different program and it worked. Thank's anyways.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
munsonpm is offline Offline
2 posts
since Sep 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Java holiday system not working...
Next Thread in Java Forum Timeline: Artificial intelligence-Hopefield network





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC