4 Replies - 809 Views - Last Post: 05 September 2009 - 10:52 AM Rate Topic: -----

#1 eyeore  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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

please could you help me im really confused with this problem please help me
i really need help badly please

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  Icon User is offline

  • The Algorithmi
  • member icon

Reputation: 727
  • View blog
  • 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]
Was This Post Helpful? 0
  • +
  • -

#3 Ice(ITB)  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 2
  • View blog
  • 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?
Was This Post Helpful? 0
  • +
  • -

#4 eyeore  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • 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();

this all i came up with i really dont know what do please help me
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

Was This Post Helpful? 0
  • +
  • -

#5 Munkon  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • 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 {

	// define your parameters
		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() 
	{
		   // define your input
			s = new java.util.Scanner(System.in); 
			int inputType = 0;
		double selaryMoney = 0;
	   System.out.print("Please enter the employee type:");
	   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.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1