Java for Mac OS X

I am using Xtools on my Mac for my Java Programming class. Am I using

Page 1 of 1

12 Replies - 1139 Views - Last Post: 05 November 2008 - 07:13 PM Rate Topic: -----

#1 sjmatt5  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 03-November 08

Java for Mac OS X

Post icon  Posted 03 November 2008 - 06:26 PM

//  Payroll_Program_Part_1.java
//  Payroll Program Part 1
//
//  Created by Jennifer  Matthews on 11/3/08.
//  Copyright  2008 __MyCompanyName__. All rights reserved.
//
//PayrollProgramPart1
import java.util.Scanner; // class Scanner

public class Payroll Program Part 1
{
    //main method begins execution of Java application
    public static void main(String args[])
    {
        //create Scanner to obtain input from command window
        Scanner input = new Scanner(System.in);

        String cleanInputBuffer; //input
        String employeeName; // input
        double hourlyRate; // input
        double hoursWorked; // input
        double sum; // weekly pay
        {
            hourlyRate = -1; // this way, both are initiated to be -1;
            hoursWorked = -1;
            System.out.print("Enter Name of Employee:");
            employeeName = input.nextLine();
				System.out.print("Enter hourly rate:"); // prompt
            hourlyRate = input.nextDouble(); // input
            
            {
                System.out.print("Enter number of hours worked:"); // prompt
                hoursWorked = input.nextDouble(); // input
            }
            sum = hourlyRate * hoursWorked; // * numbers

            System.out.printf("The employee %s was paid $ %.2f this week", employeeName, sum);
            //Clean the input buffer
        cleanInputBuffer = input.nextLine(); //Read a line of text to clean the input buffer

        } // end outer while

    } // end method main

} // end class PayrollProgramPart1//



*Edited to add the code tags In the furure please :code: That may help so see unbalandec {}

This post has been edited by pbl: 03 November 2008 - 09:31 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Java for Mac OS X

#2 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 521
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: Java for Mac OS X

Posted 03 November 2008 - 06:27 PM

...And your question is?

In the future --> :code:
Was This Post Helpful? 0
  • +
  • -

#3 sjmatt5  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 03-November 08

Re: Java for Mac OS X

Posted 03 November 2008 - 06:39 PM

View PostLocke37, on 3 Nov, 2008 - 05:27 PM, said:

...And your question is?

In the future --> :code:


My code generates three errors and I do not know how to correct them. I also wanted to know if anyone else used a Mac with Java Programming - is xTools the best platform to use for Java Programming?
Was This Post Helpful? 0
  • +
  • -

#4 xCraftyx  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 11
  • View blog
  • Posts: 258
  • Joined: 13-September 08

Re: Java for Mac OS X

Posted 03 November 2008 - 06:42 PM

what are the errors?
Was This Post Helpful? 0
  • +
  • -

#5 sjmatt5  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 03-November 08

Re: Java for Mac OS X

Posted 03 November 2008 - 06:46 PM

The first is at the line for public class Payroll Program 1 - it says that { is expected and then on the very last line it says } expected. I do not know what the third is - it does not give me a description. When I input the { at the top it generates more errors.
Was This Post Helpful? 0
  • +
  • -

#6 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8343
  • View blog
  • Posts: 31,890
  • Joined: 06-March 08

Re: Java for Mac OS X

Posted 03 November 2008 - 09:34 PM

And the problem was not with the {}

Payroll Program Part 1

Java class name cannot have space in their name... make it PayrollProgramPart1

As far as the Mac part is concerned... I know what they look like so won't advise you on that
Was This Post Helpful? 1
  • +
  • -

#7 Locke  Icon User is offline

  • Sarcasm Extraordinaire!
  • member icon

Reputation: 521
  • View blog
  • Posts: 5,596
  • Joined: 20-March 08

Re: Java for Mac OS X

Posted 03 November 2008 - 09:43 PM

View Postpbl, on 3 Nov, 2008 - 08:34 PM, said:

As far as the Mac part is concerned... I know what they look like so won't advise you on that


:lol:

Funny. Very funny.
Was This Post Helpful? 0
  • +
  • -

#8 sjmatt5  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 03-November 08

Re: Java for Mac OS X

Posted 04 November 2008 - 02:51 PM

Thanks for the help. I have one last error that I do not understand. Now whn I run this code after making the changes you suggested, I get the following error: Command /Developer/Private/jam failed with exit code 1

Any idea what that means and how to correct the problem?

Thanks again!
Was This Post Helpful? 0
  • +
  • -

#9 louisstephens  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 30-October 08

Re: Java for Mac OS X

Posted 04 November 2008 - 03:55 PM

I use a Mac, and I use Subethaedit. It is very good without a lot of clutter.

This post has been edited by louisstephens: 04 November 2008 - 03:56 PM

Was This Post Helpful? 0
  • +
  • -

#10 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8343
  • View blog
  • Posts: 31,890
  • Joined: 06-March 08

Re: Java for Mac OS X

Posted 04 November 2008 - 05:24 PM

View Postsjmatt5, on 4 Nov, 2008 - 01:51 PM, said:

Thanks for the help. I have one last error that I do not understand. Now whn I run this code after making the changes you suggested, I get the following error: Command /Developer/Private/jam failed with exit code 1

Any idea what that means and how to correct the problem?

Thanks again!

That is Mac IDE stuff right ?
Repost your code I'll see what in does on a real OS :D Just joking
Was This Post Helpful? 0
  • +
  • -

#11 sjmatt5  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 03-November 08

Re: Java for Mac OS X

Posted 05 November 2008 - 06:56 PM

//  Payroll_Program_Part_1.java
//  Payroll Program Part 1
//
//  Created by Jennifer  Matthews on 11/3/08.
//  Copyright (c) 2008 __MyCompanyName__. All rights reserved.
//
//PayrollProgramPart1
import java.util.Scanner; // class Scanner

public class PayrollProgramPart1
{
	//main method begins execution of Java application
	public static void main(String args[])
	{
		//create Scanner to obtain input from command window
		Scanner input = new Scanner(System.in);

		String cleanInputBuffer; //input
		String employeeName; // input
		double hourlyRate; // input
		double hoursWorked; // input
		double sum; // weekly pay
		{
			hourlyRate = -1; // this way, both are initiated to be -1;
			hoursWorked = -1;
			System.out.print("Enter Name of Employee:");
			employeeName = input.nextLine();
				System.out.print("Enter hourly rate:"); // prompt
			hourlyRate = input.nextDouble(); // input
			
			{
				System.out.print("Enter number of hours worked:"); // prompt
				hoursWorked = input.nextDouble(); // input
			}
			sum = hourlyRate * hoursWorked; // * numbers

			System.out.printf("The employee %s was paid $ %.2f this week", employeeName, sum);
			//Clean the input buffer
		cleanInputBuffer = input.nextLine(); //Read a line of text to clean the input buffer

		} // end outer while

	} // end method main

} // end class PayrollProgramPart1//


Was This Post Helpful? 0
  • +
  • -

#12 pbl  Icon User is offline

  • There is nothing you can't do with a JTable
  • member icon

Reputation: 8343
  • View blog
  • Posts: 31,890
  • Joined: 06-March 08

Re: Java for Mac OS X

Posted 05 November 2008 - 07:03 PM

Works for me (on Windows)
What do you expect ? the program to loop for another employee name ?
Was This Post Helpful? 0
  • +
  • -

#13 sjmatt5  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 03-November 08

Re: Java for Mac OS X

Posted 05 November 2008 - 07:13 PM

View Postpbl, on 5 Nov, 2008 - 06:03 PM, said:

Works for me (on Windows)
What do you expect ? the program to loop for another employee name ?


No, I just need it to compile and show me the message and it does not on my Mac. My professor does not use a Mac so I guess it should work for her as well.

Thanks so much for your time!

Jen
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1