Welcome to Dream.In.Code
Getting Java Help is Easy!

Join 136,261 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,186 people online right now. Registration is fast and FREE... Join Now!




work and wages assignment

 
Reply to this topicStart new topic

work and wages assignment, need help on what to do

webbywebb
14 Oct, 2008 - 08:33 AM
Post #1

D.I.C Head
**

Joined: 30 Jan, 2007
Posts: 73


My Contributions
i do not know where to start i am suppose to write a program to input names and wages for 5 workers. Then it searches one worker’s name by user’s input and removes all related findings. Lastly it outputs the highest, average, and lowest wages prior to removal and the current list of workers names and wages. You have to use Stack(s) for this program.

Sample Input and Output:

Please enter names for 5 workers:
Dave Mercy Jeff Jen Tina

Please enter wages for the above 5 workers:
1200 4000 3500 4000 2300

Please enter a worker’s name to search and then remove:
Dave

The highest wage is 4000.
The lowest wage is 1200.
The average wage is 3000.
The current list of names: Mercy Jeff Jen Tina.
The current list of wages: 4000 3500 4000 2300
User is offlineProfile CardPM
+Quote Post

webbywebb
RE: Work And Wages Assignment
14 Oct, 2008 - 10:38 AM
Post #2

D.I.C Head
**

Joined: 30 Jan, 2007
Posts: 73


My Contributions
QUOTE(webbywebb @ 14 Oct, 2008 - 09:33 AM) *

i do not know where to start i am suppose to write a program to input names and wages for 5 workers. Then it searches one worker’s name by user’s input and removes all related findings. Lastly it outputs the highest, average, and lowest wages prior to removal and the current list of workers names and wages. You have to use Stack(s) for this program.

Sample Input and Output:

Please enter names for 5 workers:
Dave Mercy Jeff Jen Tina

Please enter wages for the above 5 workers:
1200 4000 3500 4000 2300

Please enter a worker’s name to search and then remove:
Dave

The highest wage is 4000.
The lowest wage is 1200.
The average wage is 3000.
The current list of names: Mercy Jeff Jen Tina.
The current list of wages: 4000 3500 4000 2300

this is what i have done so far

CODE

import java.io.InputStream;
import java.util.Scanner;


public class UseStack {
//    
    public static void main(String[] args) {
        String input = "Hey My name is Patrick"; //Input to be displayed to user, backwards
        int sizeofStack = input.length(); //length
        Stack<Object> theStack = new ArrayStack<Object>(sizeofStack);

        for (int c = 0; c < input.length(); c++) {
          char ch = input.charAt(c);
          try {
            theStack.push(ch);//try
        } catch (Exception e) {
            // catch block
            e.printStackTrace();
        }//catch
        }//end of for

        while (!theStack.isEmpty()) {
          char ch = 0;
        try {
            ch = theStack.pop();//try
        } catch (Exception e) {
            // catch block
            e.printStackTrace();
        }
          System.out.print(ch);//System Print out input backwards
        }
      }//main
    }//end of UseStack java

User is offlineProfile CardPM
+Quote Post

JeroenFM
RE: Work And Wages Assignment
14 Oct, 2008 - 11:46 AM
Post #3

D.I.C Head
Group Icon

Joined: 30 Jun, 2008
Posts: 186



Thanked: 9 times
Dream Kudos: 100
My Contributions
Please include the correct source code. Posting unrelated code does not count as an effort.

Dream.In.Code has a policy by which we prefer to see a good faith effort on your part before providing source code for homework assignments. Please post the code you have written in an effort to resolve the problem, and our members would be happy to provide some guidance. Be sure to include a description of any errors you are encountering as well.

Please post like this:

Thank you for helping us helping you.
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 04:35AM

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month