Jump to content

Help With Java Programming Challenge

KingLuvely

I need help with my Programming Challenge in Java. I'm not asking anyone to do it but please help, I have no Idea where to go form where I am. It's due October 21, 2013 by Midnight ET. Thanks!

 

Directions:

 Programming Challenge 04

Write a class that will determine the payroll for a business for a particular pay period.  The class should include the following:
 
  1. Asks the user how many employees work for him/her
  2. Creates an array of employee names based on the number of employees entered by the user in a method called getNames()
  3. Creates an array of wages for each of employee using user input in a method called get setWages()
  4. Ask the user how many hours the company was open (we are going to make the assumption that every employee worked every hour the company was open)
  5. Create an array of doubles for the paychecks for each of the employees based on their wages and the number of open hours in a method called setPay()
  6. All input from the user should be initially accepted as a String, and then cast to the appropriate data type.
  7. Make sure to include another method called getPayroll() that either prints or returns the final information.

My code:

 

 

 
package unit2;
 
/* Justin Gallman
*date 16-Oct-2013
*Modified:
*/
 
import java.util.*;
 
public class PC04 {
 
    public static void main(String[] args) {
        Scanner kb=new Scanner(System.in);
        System.out.println("How many employees do you have? ");
        int emp=kb.nextInt();
        
        
 
    }
}
Link to comment
Share on other sites

Link to post
Share on other sites

@KingLuvely

I won't give you code, but I can break down what you need to do.

  1. make the getNames() method of your class
  2. prompt user for the number of names
  3. make a String array of that size (this is important, because the size of the array cannot be changed later)
  4. prompt for names, and then save each one to the array
  5. make a call in main() to getNames() so it will actually be executed

setWages() is similar, just make an int array.

Part 4 of your directions is very simple--if you've completed the stuff up to it, you'll know how to do it.

[spoiler=My Current PC]AMD FX-8320 @ 4.2 Ghz | Xigmatek Dark Knight Night Hawk II | Gigabyte GA-990FXA-UD3 | 8GB Adata XPG V2 Silver 1600 Mhz RAM | Gigabyte 3X Windforce GTX 770 4GB @ 1.27 Ghz/7.25 Ghz | Rosewill Hive 550W Bronze PSU | Fractal Design Arc Midi R2 | Samsung Evo 250 GB SSD | Seagate Barracuda 1TB HDD | ASUS VS239H-P | Razer Deathadder 2013 Partlist

 

LTT Build-Off Thread: http://linustechtips.com/main/topic/35226-the-ltt-build-off-thread-no-building-required/

Link to comment
Share on other sites

Link to post
Share on other sites

As you are probably aware, you won't learn if we just write it for you.

 

I love programming as I really do enjoy problem solving. I find it the most rewarding form of it, as usually its something to aid in a repetitive or time consuming task, but also to see your creation work, then advance as you edit/re-write it to become more efficient as you become more comprehensive and comfortable with the language.

 

It also teaches good methodical and analytical problem solving.

 

 

 

A few tips;

 

- Break down each step of the program; input, calculation/sorting/data processing/etc..., output. Good segmentation allows you to focus easily on one step at a time, then sow it all together.

 

- Remember to use quotes to outline what you did, why you did it or what a specific set of instructions do. (it also helps people reading your code, be nice! :P)

 

- Try to re-write the instructions, taking key words or parts and arranging them on a page similarly to the way the program will run. It will give you a really basic structure/outline to the code layout and may help you work it out.

 

- Use the debugger constructively. Sometimes, if I don't quite understand something, I will force an error to see what part of the program that code is affecting. Helps me to dissect and analyse what functions/etc.. are doing, and as I'm doing it it tends to stick better. 

 

 

 

These steps usually help me and I'm sure I'm missing something... :S

 

Good luck! :)

 

 

 

Also, @CornOnJacob I have the Dell 1745, well my grandparents use it now, it was a great machine while I had it! Although a little miffed that the i5 model was released a WEEK after I got mine...

Link to comment
Share on other sites

Link to post
Share on other sites

Also, @CornOnJacob I have the Dell 1745, well my grandparents use it now, it was a great machine while I had it! Although a little miffed that the i5 model was released a WEEK after I got mine...

It's a great laptop (series). Back when I got it I wasn't into gaming or rendering, so it is a bit underpowered for my needs.

(Sorry KingLuvely for derailing the thread a bit)

[spoiler=My Current PC]AMD FX-8320 @ 4.2 Ghz | Xigmatek Dark Knight Night Hawk II | Gigabyte GA-990FXA-UD3 | 8GB Adata XPG V2 Silver 1600 Mhz RAM | Gigabyte 3X Windforce GTX 770 4GB @ 1.27 Ghz/7.25 Ghz | Rosewill Hive 550W Bronze PSU | Fractal Design Arc Midi R2 | Samsung Evo 250 GB SSD | Seagate Barracuda 1TB HDD | ASUS VS239H-P | Razer Deathadder 2013 Partlist

 

LTT Build-Off Thread: http://linustechtips.com/main/topic/35226-the-ltt-build-off-thread-no-building-required/

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×