**I'm to the point I think where I can ask a user to input a string value,
answer is Hourly.
if hourly the user enters hours, then the program prints out value in currency format

answer is Salary
user enters which salary level
Level 1 is for recent college grads
Level 2 is for executives

level one and level 2 have different salary levels and pay is calulated on a bi-weekly pay schedule**

import java.io.*;

public class Payroll
{

   public static void main( String args[] )throws IOException
{
    System.out.println("Are you an Hourly or Salary worked?");
    BufferedReader br;
        br = new BufferedReader( new InputStreamReader( System.in ) );//gathers data from user 
    String line = br.readLine();

    if(line.equals("Hourly"))
    {
        System.out.println("Enter Hours Worked");
        System.out.println("Enter Pay Rate");
    }
 [COLOR="Red"]       //a. If hourly then ask for the following
//i. Hours worked
//ii. Pay Rate
//1. If the hours worked is greater than 40 hours then you must calculate total 
//pay for the first 40 hours at the pay rate given and then calculate hours 
//above 40 at time and a half[/COLOR]

//        
    else if(line.equals("Salary"))
    {
    System.out.println("Enter a Salary level 1 or 2");
    } //Level 1 is for recent college grads
        //Level 2 is for executives
    else
    {
        System.out.println("     ");
        }
    }

}

//iii. The bottom line is just set to constant variables with the yearly 
//salary for either level and calculate the pay based on bi-weekly pay schedule.

//4. Be able to print/show the results for the date taken in after all data has been entered.

//5. Please put this into a loop that will allow more than one entry. 

//FORMAT THE RESULT AS A CURRENCY (w/ a $ sign in front of it)

Recommended Answers

All 5 Replies

Wait? What is your actual question, if I may ask.
This looks like an assignment I had one day :p

My question is I'm wondering what kind of control state I should use.
I know there is an IF statement in there, but I question how I would do that and when a condition is found true CONVERT USER INPUT so that I there program can calculate there entries to currency$
also
When a user enters selections I'm not sure how to convert those selections to FORMAT CURRENCY so that the strings they enter can be converted to output currency

Thanks for you feedback

Personally I have no idea what are you talking about. If you want to change a String to int then use:
String s="2";
int i=Integer.parseInt(s);

The rest of your post don't make any sense

I have read with more attention your post and I think that when you get the salary you can print it with a '$' at the beginning. I don't know if this is what you want because it sounds to easy:
String salary="20.00";
System.out.println("$"+salary);

I hope this makes it clearer
What this program is suppose to do is.

Prompt a user to enter HOURLY or SALARY worker
If HOURLY Worker, the User will enter hours worked & pay rate

If hours worked are > 40 calculate total pay for the first 40 hours at the entered pay rate given and then calculate hours above 40 at time and a half

THE DISPLAY WILL BE
HOURLY Worker
Worked: X number of hours
Paid: X amount of $ (format as US curreny)


If Salary Worker, the user will enter hours worked & Salary Level 1 or Level 2
Level 1 has one salary level
Level 2 has another salalry level
//Pay is calculated on a bi-weekly schedule for salary workers

THE DISPLAY WILL BE
Salary Worker
Worked: X number of hours
Paid: X amount of $ (format as US curreny)
//Pay is calculated on a bi-weekly schedule for salary workers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.