Java 5 with Mac OS X

Reply

Join Date: Sep 2006
Posts: 2
Reputation: munsonpm is an unknown quantity at this point 
Solved Threads: 0
munsonpm munsonpm is offline Offline
Newbie Poster

Java 5 with Mac OS X

 
0
  #1
Sep 7th, 2006
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Java 5 with Mac OS X

 
0
  #2
Sep 8th, 2006
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?
As people are clearly allowed to attack me but I'm not allowed to defend myself, I no longer post to this site.
Reply With Quote Quick reply to this message  
Join Date: Sep 2006
Posts: 2
Reputation: munsonpm is an unknown quantity at this point 
Solved Threads: 0
munsonpm munsonpm is offline Offline
Newbie Poster

Re: Java 5 with Mac OS X

 
0
  #3
Sep 8th, 2006
I found out that jEdit's plugin doesn't work with macosx. I tried a different program and it worked. Thank's anyways.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC