# please could you help me with my java problem

Page 1 of 1

## 4 Replies - 1332 Views - Last Post: 05 September 2009 - 10:52 AMRate Topic: //<![CDATA[ rating = new ipb.rating( 'topic_rate_', { url: 'http://www.dreamincode.net/forums/index.php?app=forums&module=ajax&section=topics&do=rateTopic&t=124043&amp;s=d0adbd44c9208f08384dc3f056d02d97&md5check=' + ipb.vars['secure_hash'], cur_rating: 0, rated: 0, allow_rate: 0, multi_rate: 1, show_rate_text: true } ); //]]>

### #1 eyeore

Reputation: 0
• Posts: 13
• Joined: 05-September 09

# please could you help me with my java problem

Posted 05 September 2009 - 02:45 AM

Hi everyone could you help me with my java problem my prof got this in a seat-work but i really don't know how to solve this java problem please help me and also i got 0 over 100 in my seat-work please kindly help me step by step
on how to solve this java problem

Write a program that will calculate the income of an employee an employee is either a part-time employee or a full-time employee.get 1 represents a part-time employee and 2 represents a full-time employee. A full time employee and part-time employee regular member of hours work in a week is 40 number of hours worked that exceeds regular number of hour rate is 40.00 dollar while full-time employees hour rate 15% of hourly rate multiplied by the number of overtime hours. the overtime pay should be computed if and only if the overtime hours rendered is not zero

This post has been edited by eyeore: 05 September 2009 - 04:50 AM

Is This A Good Question/Topic? 0

## Replies To: please could you help me with my java problem

### #2 mostyfriedman

• The Algorithmi

Reputation: 729
• Posts: 4,473
• Joined: 24-October 08

## Re: please could you help me with my java problem

Posted 05 September 2009 - 03:45 AM

[rules][/rules]

### #3 Ice(ITB)

Reputation: 2
• Posts: 48
• Joined: 19-August 09

## Re: please could you help me with my java problem

Posted 05 September 2009 - 04:07 AM

maybe your lost as a result of surviving on other peoples code?

ah well

You need to give the code you've done so far so we can help you.

As far as I see looks like you need a switch for each option i,e 1,2,3,4 and each case in the switch is a call to a method which executes each task.

You kinda need to give more info on the actual question as well. Does it need to store each employee and his earnings in a text file or does it simply just work out payment for one person and end?

### #4 eyeore

Reputation: 0
• Posts: 13
• Joined: 05-September 09

## Re: please could you help me with my java problem

Posted 05 September 2009 - 05:05 AM

Im really sorry this all i came up with since i really suck at java even my prof laugh at me my classmate laugh at me please help me finish this code even if the the seat-work was already done 5 days ago please

import java.util.Scanner;

public class employee {
public static void main(String[] args) {

int num = 40;
double dollar = 40.00;
double hRate = 15%

Scanner in = new Scanner(System.in);

System.out.print("Income of an Employee");
num = input.nextInt();

System.out.print("Part time employee ");
num = in.nextInt();

System.out.print("Full time employee ");
hRate = in.nextDouble();

im really confused and wish that you could guide me step by step since my prof rarely give example please help me

This post has been edited by eyeore: 05 September 2009 - 05:07 AM

### #5 Munkon

Reputation: 5
• Posts: 61
• Joined: 13-August 09

## Re: please could you help me with my java problem

Posted 05 September 2009 - 10:52 AM

Hi,
Try this code, it might help.
Please don't take it as is, but learn this according to the comments I wrote.
The learning is more important than the HW..

```import com.sun.java_cup.internal.runtime.Scanner;

public class Employee {

private int hours = 40;
private double selary = 40.00;
private double hRate = 1.15;
private java.util.Scanner s;

// constractor that calls the method that works
public Employee() {
makeEmployee();
}

private void makeEmployee()
{
s = new java.util.Scanner(System.in);
int inputType = 0;
double selaryMoney = 0;
System.out.println("part-time:press 1 , full-time: press 2...");

// allways work
while (true)
{
// catches if the input is not int
try
{
inputType = Integer.parseInt(s.next());
}
catch (Exception e)
{
inputType = 3;
}

if (inputType == 1 || inputType == 2)
{
break;
}
System.out.print("Please enter the employee type again (only 1 or 2):");
System.out.println("part-time:press 1 , full-time: press 2...");
}

if(inputType == 1)
{
selaryMoney = hours*selary;
}
else
{
selaryMoney = hours*selary*hRate;
}
System.out.println("the selary is: " + selaryMoney);
}

public static void main(String[] args) {
Employee emp  = new Employee();

}
}

```

Good luck.

Munkon.