473,388 Members | 1,198 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,388 software developers and data experts.

Error message when compiling

Hi !
New to the boards here. I am in wk 2 of a java programming class. We had to submit an assignment and this is what I did:
// checkpoint 2.2: WeeklyPay1.java
// Printing name of employee and weekly pay amount.
import java.util.scanner; // program uses class scanner

public class WeeklyPay1
{
// 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 );

int name1; // Name Of Employee
int numberhrs; // number of hours worked
int hourlypay; // pay per hour
int sum; // numberhrs * hourlypay

System.out.print( " Enter Name Of Employee: " ); // prompt
name1 = input.nextInt(); // read first name from user

System.out.print( " Enter Number Of Hours Worked: "); // prompt
numberhrs = input.nextInt(); // read number of hours worked from user

System.out.print( " Enter Hourly Pay: " ); // prompt
hourlypay = input.nextInt(); // read hourly pay

sum = numberhrs * hourlypay; // multiply numbers

System.out.printf( "Sum is $d\n", Name employee ); // display employee name and weekly pay amount

} // end method main

} // end class WeeklyPay1

and this is the error messsage I am getting:

C:\Documents and Settings\Sabrina\Desktop\WeeklyPay1.java:29: ')' expected
System.out.printf( "Sum is $d\n", sum, employee name ); // display sum; name of employee
^
1 error

Tool completed with exit code 1

Please help!
thanks
sabrina
Jun 26 '07 #1
8 1798
nomad
664 Expert 512MB
Hi !
New to the boards here. I am in wk 2 of a java programming class. We had to submit an assignment and this is what I did:
// checkpoint 2.2: WeeklyPay1.java
// Printing name of employee and weekly pay amount.
import java.util.scanner; // program uses class scanner

public class WeeklyPay1
{
// 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 );

int name1; // Name Of Employee
int numberhrs; // number of hours worked
int hourlypay; // pay per hour
int sum; // numberhrs * hourlypay

System.out.print( " Enter Name Of Employee: " ); // prompt
name1 = input.nextInt(); // read first name from user

System.out.print( " Enter Number Of Hours Worked: "); // prompt
numberhrs = input.nextInt(); // read number of hours worked from user

System.out.print( " Enter Hourly Pay: " ); // prompt
hourlypay = input.nextInt(); // read hourly pay

sum = numberhrs * hourlypay; // multiply numbers

System.out.printf( "Sum is $d\n", Name employee ); // display employee name and weekly pay amount

} // end method main

} // end class WeeklyPay1

and this is the error messsage I am getting:

C:\Documents and Settings\Sabrina\Desktop\WeeklyPay1.java:29: ')' expected
System.out.printf( "Sum is $d\n", sum, employee name ); // display sum; name of employee
^
1 error

Tool completed with exit code 1

Please help!
thanks
sabrina
First welcome to thescripts
and please use the Wrap code tag. It's locate on top of the message box looks like this #

you have several mistakes.
1. look this line
Scanner input = new scanner( System.in ); Something needs to be in upper cap.

2 your main error lies here,
System.out.printf( "Sum is $d\n", Name employee );
What is Name employee doing? Don't you want to print the employee and hours, look at your objects that you have declared.


nomad
Jun 26 '07 #2
the owner of this posting is there or not????
u have made a lot of mistakes ,.....
plz hold on while i clear it out....
Jun 26 '07 #3
This is the solution to your problem.....



Expand|Select|Wrap|Line Numbers
  1.  import java.util.Scanner;
  2.  
  3. public class WeeklyPay1 {
  4. // main method begins execution of Java application
  5.     public static void main(String[] args) {
  6. // create Scanner to obtain input from command window
  7.         Scanner input = new Scanner( System.in );
  8.  
  9.         String name1; // Name Of Employee
  10.         int numberhrs; // number of hours worked
  11.         int hourlypay; // pay per hour
  12.         int sum=0; // numberhrs * hourlypay
  13.  
  14.         System.out.println( " Enter Name Of Employee: " ); // prompt
  15.         name1 = input.next(); // read first name from user
  16.  
  17.         System.out.println( " Enter Number Of Hours Worked: "); // prompt
  18.         numberhrs = input.nextInt(); // read number of hours worked from user
  19.  
  20.         System.out.println( " Enter Hourly Pay: " ); // prompt
  21.         hourlypay = input.nextInt(); // read hourly pay
  22.  
  23.         sum = numberhrs * hourlypay; // multiply numbers
  24.  
  25.         System.out.println("sum is ::" +sum); // display employee name and weekly pay amount
  26.  
  27.     } // end method main
  28.  
  29. } // end class WeeklyPay1
  30.  
Enjoy.....
Jun 26 '07 #4
nomad
664 Expert 512MB
This is the solution to your problem.....



Expand|Select|Wrap|Line Numbers
  1.  import java.util.Scanner;
  2.  
  3. public class WeeklyPay1 {
  4. // main method begins execution of Java application
  5. public static void main(String[] args) {
  6. // create Scanner to obtain input from command window
  7. Scanner input = new Scanner( System.in );
  8.  
  9. String name1; // Name Of Employee
  10. int numberhrs; // number of hours worked
  11. int hourlypay; // pay per hour
  12. int sum=0; // numberhrs * hourlypay
  13.  
  14. System.out.println( " Enter Name Of Employee: " ); // prompt
  15. name1 = input.next(); // read first name from user
  16.  
  17. System.out.println( " Enter Number Of Hours Worked: "); // prompt
  18. numberhrs = input.nextInt(); // read number of hours worked from user
  19.  
  20. System.out.println( " Enter Hourly Pay: " ); // prompt
  21. hourlypay = input.nextInt(); // read hourly pay
  22.  
  23. sum = numberhrs * hourlypay; // multiply numbers
  24.  
  25. System.out.println("sum is ::" +sum); // display employee name and weekly pay amount
  26.  
  27. } // end method main
  28.  
  29. } // end class WeeklyPay1
  30.  
Enjoy.....
You're not helping this person by solving their homework for them. Please try to give them clues or directions on what they are doing wrong.
thanks
nomad
Jun 26 '07 #5
r035198x
13,262 8TB
You're not helping this person by solving their homework for them. Please try to give them clues or directions on what they are doing wrong.
thanks
nomad
I second that
Jun 26 '07 #6
Wow,
Thanks for the welcome and the responses. I appreciate the answer to my homework, as I can see I did it completly different. Is that why my program had an error? or would I have gotten the same results by using my program? I am trying to see if there is more then one way to write a program and get the same result or if it is a black and white issue. only one way to be right.
thanks everyone for the help...this newbe needs all she can get!

-Sabrina
Jun 26 '07 #7
efultz
5
Wow,
Thanks for the welcome and the responses. I appreciate the answer to my homework, as I can see I did it completly different. Is that why my program had an error? or would I have gotten the same results by using my program? I am trying to see if there is more then one way to write a program and get the same result or if it is a black and white issue. only one way to be right.
thanks everyone for the help...this newbe needs all she can get!

-Sabrina
Rarely, if ever, is there only one solution to a programming situation.
Jun 26 '07 #8
ok good to know! thanks!
Jun 29 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: RichG | last post by:
I have a problem where DB2 is returning error 'DIA9999E An internal error occurred. Report the following error code : "error code -32"'. This is happening on DB2 for Windows, v7.2.9 when compiling...
16
by: pj | last post by:
(Was originally, probably wrongly, posted to the vc subgroup.) (This doesn't appear to be a c# problem, but a problem with a bug in the Visual Studio c# compiler, but, any help will be welcome...)...
2
by: Gustavo | last post by:
After updating Windows 2000 I began to get a weird compile error message: Deleting intermediate files and output files for project 'pp - Win32 Debug'. --------------------Configuration: pp -...
2
by: Qiao Yun | last post by:
I used vc++.net (visual studio .net ) to open a project which can work well in vc++6.0. I succeeded in compiling the project in vc++.net in release mode . But when I tried to compile the project...
8
by: pmud | last post by:
Hi, I am using a compare validator in asp.net application(c# code). This Custom validator is used for comparing a value enterd by the user against the primary key in the SQL database. IF the...
0
by: Herman Jones | last post by:
I'm getting the following error when I build a Class Library project: Embedding manifest... Project : error PRJ0002 : Error result 1 returned from 'C:\WINDOWS\system32\cmd.exe'. It happens with...
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
6
by: Gaijinco | last post by:
I'm having a weird error compiling a multiple file project: I have three files: tortuga.h where I have declared 5 global variables and prototypes for some functions. tortuga.cpp where I...
1
by: sahilrekhi | last post by:
Hi i am working on a graphical user interface deisgn programme. when i compile the file i i get the following output with the mentioned errors: 1>------ Rebuild All started: Project: guiq,...
1
by: SQACPP | last post by:
I have an error when compiling a simple form project... I just start a new Form project and add a new PictureBox in a form(or anything that generate the .resx file) After that when compiling I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.