What am I doing wrong.
Welcome to the Java Programming Forums
The professional, friendly Java community. 21,500 members and growing!
The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.
>> REGISTER NOW TO START POSTING
Members have full access to the forums. Advertisements are removed for registered users.
What am I doing wrong.
Please explain in more detail.What am I doing wrong
Please copy and paste the full text of any error messages and paste it here.
Also post the full text of the code, be sure to wrap your code with code tags:
[code=java]
YOUR CODE GOES HERE
[/code]
to get highlighting and preserve formatting.
If you don't understand my answer, don't ignore it, ask a question.
SANA4SPA (September 22nd, 2014)
3.2 Write an if statement that multiplies payRate by 1.5 If hours are greater than 40
import java.util.Scanner;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author user
*/
public class Payrate
{
public static void main(String[] args)
// 3.2 Write an if statement that multiplies payRate by 1.5 If hours are greater than 40
{ //create scanner object to read input.
Scanner keyboard = new Scanner(System.in);
//String payRate;
//String pay;
//String hrs;
int Payrate;
int Pay;
int Hrs;
// GET USER INPUT
//prompt user and get first name
//System.out.println("Lets calculate your pay\n");
System.out.print("Enter the hrs worked: \n");
Hrs =keyboard.nextInt();
System.out.print("Enter your pay rate: \n");
Payrate =keyboard.nextInt();
if (Hrs>40)
Pay=(Hrs*Payrate);
Pay =keyboard.nextInt();
System.out.println("This is your" +Pay);
}
}
As already requested and explained, please post your code using code or highlight tags as explained near the top of this topic.