Now i see what Norm was talking about, I have it now
Thank you very much both of you.

I guess i was looking at the wrong line's when he said to validate the array.. so i should put the validation before 80 and then use return; correct

new code looks like this.

import java.awt.*; //imports all Java.awt
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*; // Imports all swing 
/*
Author James Perkins
* Intro to programming
* Task 1
* 
*/

class Tuthelp extends JFrame {

    private JPanel panel;
        private JLabel TutorTimeLabel; // Time label
    private JTextField timeField; // Field for time info
    private JLabel TutorWageLabel; //Label for Tutor wages
    private JTextField wageField; // Field to enter info for Wage
    private JTextArea textArea; // Text where all GUI info will show after report is run 
    private JButton enterButton; //Enter Button in GUI
    private JButton runReportsButton; // Run report in GUI
    private JButton quitButton; // Exit program button
    final int WINDOW_WIDTH = 600; // Window Width
    final int WINDOW_HEIGHT = 600; // Window height
    double [][] studentData = new double [3][3]; // 
        int nextStudent=0;

        public Tuthelp()
    {
    setTitle("Tutor Earnings "); // GUI title
        setSize(WINDOW_WIDTH, WINDOW_HEIGHT); //sets the size of the window.
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
        buildPanel();
        add(panel);
        setVisible(true);
}

        public void buildPanel(){
  //* This part Creates the GUI using labels and Panels described below/*

        TutorTimeLabel = new JLabel("Tutor Time");
    timeField = new JTextField(10);
    TutorWageLabel = new JLabel ("Tutor Earnings");
    wageField = new JTextField(10);
    textArea = new JTextArea(25,50);
    enterButton = new JButton("Enter");
    enterButton.addActionListener(new Tuthelp.enterButtonListener());
    runReportsButton = new JButton("Run Reports");
    runReportsButton.addActionListener(new Tuthelp.runReportsButtonListener());
    quitButton = new JButton("Quit");
    quitButton.addActionListener(new quitButtonListener());
    panel = new JPanel();
    panel.add(TutorTimeLabel);
    panel.add(timeField);
    panel.add(TutorWageLabel);
    panel.add(wageField);
    panel.add(textArea);
    panel.add(enterButton);
    panel.add(runReportsButton);
    panel.add(quitButton); 
    }

    private class enterButtonListener implements ActionListener // Actions performed when enter is hit are below
    {

    public void actionPerformed(ActionEvent e)

        {      
        boolean error =false; ...

So i tried using a boolean to validate the input, and use a return; but that still causes the array to recieve the date

Yes, I caught i was using the word throw sorry. I would like the program to essiently give them the option to re-enter the info so it would have to start the enterButton action again, basicly all i want the program to do is not let them enter the info, if they enter 240 as the minutes it currently will let the array accept it and calculate it in the report.

When it finds the invalid value on line 17 it shows the You have Tutored this Person too long", "Error", it should stop it from entering the information so they can re-enter the info correctly.

 private class enterButtonListener implements ActionListener // Actions performed when enter is hit are below
    {
    public void actionPerformed(ActionEvent e)
        {      
        boolean error =false;
        double minsIdx = Double.parseDouble(timeField.getText());
        double wagesIdx= Double.parseDouble(wageField.getText());     
        studentData[nextStudent][0] = minsIdx;        // Minutes entered
        studentData[nextStudent][1] = wagesIdx;       // Wages Entered 
        nextStudent++; //  Ready for the next Student entry.
        // the following Code below is an IF statement to make sure the user enters the correct information.
        time:
        if (minsIdx <=0){
    JOptionPane.showMessageDialog(null, "Please enter a time larger than 0", "Error",
    JOptionPane.ERROR_MESSAGE);
                }
        else if (minsIdx >= 240)
        {    
    JOptionPane.showMessageDialog(null, "You have Tutored this Person too long", "Error",
    JOptionPane.ERROR_MESSAGE);
        error = true;
        break time;
        }else{
    if(wagesIdx <= 0) // They must get paid so error if wage is zero.
    {
    JOptionPane.showMessageDialog(null, "Please enter a wage", "Error", 
    JOptionPane.ERROR_MESSAGE);
        }
        timeField.setText("");
        wageField.setText("");
    wageField.requestFocus();
        timeField.requestFocus();
    }
    }
    }

here sorry its minsIdx

Hi guys, i dont think im using the boolean and break correctly i need it to see the tutormin>=240 and then throw the error and stop without exiting the program. can someone take a look and help me edit it

import java.awt.*; //imports all Java.awt
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*; // Imports all swing 
/*
Author James Perkins
* Intro to programming
* Task 1
* 
*/

class Tuthelp extends JFrame {

    private JPanel panel;
        private JLabel TutorTimeLabel; // Time label
    private JTextField timeField; // Field for time info
    private JLabel TutorWageLabel; //Label for Tutor wages
    private JTextField wageField; // Field to enter info for Wage
    private JTextArea textArea; // Text where all GUI info will show after report is run 
    private JButton enterButton; //Enter Button in GUI
    private JButton runReportsButton; // Run report in GUI
    private JButton quitButton; // Exit program button
    final int WINDOW_WIDTH = 600; // Window Width
    final int WINDOW_HEIGHT = 600; // Window height
    double [][] studentData = new double [3][3]; // 
        int nextStudent=0;

        public Tuthelp()
    {
    setTitle("Tutor Earnings "); // GUI title
        setSize(WINDOW_WIDTH, WINDOW_HEIGHT); //sets the size of the window.
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
        buildPanel();
        add(panel);
        setVisible(true);
}

        public void buildPanel(){
  //* This part Creates the GUI using labels and Panels described below/*

        TutorTimeLabel = new JLabel("Tutor Time");
    timeField = new JTextField(10);
    TutorWageLabel = new JLabel ("Tutor Earnings");
    wageField = new JTextField(10);
    textArea = new JTextArea(25,50);
    enterButton = new JButton("Enter");
    enterButton.addActionListener(new Tuthelp.enterButtonListener());
    runReportsButton = new JButton("Run Reports");
    runReportsButton.addActionListener(new Tuthelp.runReportsButtonListener());
    quitButton = new JButton("Quit");
    quitButton.addActionListener(new quitButtonListener());
    panel ...

after, try for a couple of hours thinking its my code. it was actually the txt file it was reading, it was formatted incorrectly, and therefore not reading the file. Now i feel stupid... thanks for checking my code again though :)

What you have there is exactly what the Agentreport.txt should contain.... Did you copy my code exactly or make a change somewhere?

Hi guys, so my task is as follows.
A. Develop an application that reads your listings.txt file, analyzes the property listed per agent, and outputs a report to an agentreport.txt file. Your application should do the following:

  1. Prompt the user for the name of the input file (listings.txt).
  2. Open listings.txt file and read in property listings.
  3. Store each property type into a Set.
    a. Convert property type to upper case before adding to your Set using method(s) from String class.
    b. Sort your Set of property types alphabetically.
  4. Use a Map to calculate total property listed in dollars and cents for each agent id.

Note: Agent id would be the key, and accumulated total of property listed would be the value.

• Sort your Map by agent id.
• Create an agentreport.txt file.

  1. Use an Iterator to iterate through your Set and write your sorted set of property types sold by the agents to the agentreport.txt file.
  2. Iterate through your Map to write your sorted pair of agent id and total property listed to the agentreport.txt file.

So I have written the code, and my output file is missing data.

Here is an example of the input and then the output files (what they should look like)
Example listings.txt file:

110001 commercial 500000.00 101
110223 residential 100000.00 101
110020 commercial 1000000.00 107
110333 land 30000.00 105
110442 farm 200000.00 106
110421 land 40000.00 107
112352 residential 250000.00 110

Example agentreport.txt file:

COMMERICAL
FARM
LAND ...

Thank you, i just realized it was inside the method after i said that! this was a pain in the ass. but thank you Norm and James as well.

Okay so i need to modifiy the int nextStudent=0 correct?

Okay so i have re-worked my code, everything functions except I still for some reason cannot add more then one student data. Always does the latest one i hit enter for. here is the full code:

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

class Tuthelp extends JFrame {

    private JPanel panel;
        private JLabel TutorTimeLabel; // Time label
    private JTextField timeField; // Field for time info
    private JLabel TutorWageLabel; //Label for Tutor wages
    private JTextField wageField; // Field to enter info for Wage
    private JTextArea textArea;
    private JButton enterButton; //Enter Button in GUI
    private JButton runReportsButton; // Run report in GUI
    private JButton quitButton; // Exit program button
    final int WINDOW_WIDTH = 600; // Window Width
    final int WINDOW_HEIGHT = 600; // Window height
    //double [] tutorMin = new double [2];
    //double [] tutorWage = new double [2];
    double [][] studentData = new double [20][2];

        public Tuthelp()
    {
    setTitle("Tutor Earnings ");
        setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        buildPanel();
        add(panel);
        setVisible(true);
}

        public void buildPanel(){

        TutorTimeLabel = new JLabel("Tutor Time");
    timeField = new JTextField(10);
    TutorWageLabel = new JLabel ("Tutor Earnings");
    wageField = new JTextField(10);
    textArea = new JTextArea(25,50);
    enterButton = new JButton("Enter");
    enterButton.addActionListener(new Tuthelp.enterButtonListener());
    runReportsButton = new JButton("Run Reports");
    runReportsButton.addActionListener(new Tuthelp.runReportsButtonListener());
    quitButton = new JButton("Quit");
    quitButton.addActionListener(new quitButtonListener());
    panel = new JPanel();
    panel.add(TutorTimeLabel);
    panel.add(timeField);
    panel.add(TutorWageLabel);
    panel.add(wageField);
    panel.add(textArea);
    panel.add(enterButton);
    panel.add(runReportsButton);
    panel.add(quitButton); 
    }

    private class enterButtonListener implements ActionListener
    {

    public void actionPerformed(ActionEvent e)
        {
        int nextStudent=0;
    double minsIdx = Double.parseDouble(timeField.getText());
        double wagesIdx= Double.parseDouble(wageField.getText());     

        studentData[nextStudent][0] = minsIdx;        
        studentData[nextStudent][1] = wagesIdx;

        nextStudent++;

    if (minsIdx <=0)
    {
    JOptionPane.showMessageDialog(null, "Please enter ...

Thank you for the information. i actually the Enter button to work now to work on the report side of things!

So i gather this is where i need to change the coding within the Enter button section

{

    public void actionPerformed(ActionEvent e)
    {

    int count = 0;
    double num1 = 0;
    double num2 = 0; 
    double m = Double.parseDouble(timeField.getText());
    double w = Double.parseDouble(wageField.getText());
    num1 = m ;
    num2 = w ;

    if (num1 <=0)
    {
    JOptionPane.showMessageDialog(null, "Please enter a time larger than 0", "Error",
    JOptionPane.ERROR_MESSAGE);
    }else if (num1 > 240)
    {
    JOptionPane.showMessageDialog(null, "You have worked to many mintues this week", "Error",
    JOptionPane.ERROR_MESSAGE);
    }else{

    }

    for(double i = 0; i< 3; i++)
    {

    }
    if(num2 < 0)
    {
    JOptionPane.showMessageDialog(null, "Please enter a wage", "Error", 
    JOptionPane.ERROR_MESSAGE);
    }
    for(int i = 0; i < 3; i++)
    {

    for(count = 1; count <=3; count++){
    }
    tutorMin[0] = m;
    tutorWage[1] = w;

    timeField.setText("");
    wageField.setText("");
    wageField.requestFocus();
        timeField.requestFocus();

    }
    }
    }

I understand the array has to go in here somewhere, but i have tried 8 different variation of this piece of code and no a single one works. I dont understand this at all.

Is this what i want to put in there instead

So basicly its going to look like

public class wageInput
{
   public static void main(String[] args)
   {
       double [ ] [ ] wages = new double [ 5 ] [ 2 ] ; //create memory space for entire matrix
       // Fill the matrix with user input
       int row, column;
       double sum;
       for (row= 0;row++ )
       {
       sum =0;
       for(column= 0;column++ )
       {
            sum[row][column] =

This is me guessing I know there is more to write, but this seems overly complicated for some reason, I cant wrap my head around this for some reason

is this start even in the ball park? and where within the code do i want to enter it, ive never really used an 2d array like this before.....

public class wageInput
{
   public static void main(String[] args)
   {
       double [ ] [ ] wages = new double [ 2 ] [ 5 ] ; //create memory space for entire matrix

       // Fill the matrix with user input
       int row, column;
       double sum;

The rows are for each student, and the maximum is 5.

I'm sorry I think you misunderstood, its one tutor, who tutor's many students. so they are entering there own information. So my example above would be the same tutor who worked twice on that day once for 60 mintues and then once for a 100 minutes

The individual workings for example if they tutored two different people on the same day, the first for 60mins getting paid 50dollars and then second person working for 100mins getting paid 200.00.

In the first column will be mintues and the second will be tutor wage:

    60.00      50.00
    100.00     200.00

To answer the IF else statement question, I am not sure if the IF statement i wrote is the same as the requirements, maybe I should of explained that better..

Also im supposed to be using two-dimensional array to store the information after I hit enter and im not sure how to implement, by the looks of it.

I sure can. Currently the IF statement works however I am missing something:

wage = "Above Minimum Wage";
            }else if ((average < MIN_WAGE)&&(average > MIN_WAGE))
            {
                wage = "Equal to Minimum Wage";
            }else if (average < MIN_WAGE)
            {
                wage = "Below Minimum Wage";
            }

and the requirements are:
if average wages per hour is < minimum wage, then below average

  • if average wages per hour is ≥ minimum wage AND ≤ minimum wage × 2.00,
    then average
  • if average wages per hour is > minimum wage × 2.00, then above average
    the bit that holds me up there, is how do i Change to code to reflect that requirement.

here is a picture before enter is pressed [IMG]http://i47.tinypic.com/dyaj3t.jpg[/IMG]
here is a picture after enter is pressed [IMG]http://i50.tinypic.com/mhd4qs.jpg[/IMG]
here is a pic after the report is run [IMG]http://i45.tinypic.com/nxiky.jpg[/IMG]

As you can see, Once enter is pressed, the program doesnt display in the TextArea what is entered, and also if i type more then one set of mintues and wages, it forgets the first set.

I would like to think that this line below maybe your issue... However without seeing the full code, its difficult to see. is it possible for you to post the Full code?

    initComponents(); // initializes all the GUI elements - created by netbeans

hi Guys, I am currently coding for a GUI based program that delivers the amount of time a tutor works in minutes and the amount they go paid total, giving them details on the amount of time work total, and wage per hour and if it is below, minimum, or above minimum wage. I currently have to problems and not sure how to work them out.

  1. Program does not let me enter more then one set of hours work and wages paid, and also does not show this within the GUI when I press the Enter button. ( using a two dimensional array to store that info)
  2. Im not sure how to change the IF statement regarding the minimum wage to reflect,
    if average wages per hour is < minimum wage, then below average
    • if average wages per hour is ≥ minimum wage AND ≤ minimum wage × 2.00,
      then average
    • if average wages per hour is > minimum wage × 2.00, then above average

Please see my code below thanks in advance

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

public class Tutorhelp extends JFrame 
{
    private JPanel panel;
    private JLabel TutorTimeLabel; // Time label
    private JTextField timeField; // Field for time info
    private JLabel TutorWageLabel; //Label for Tutor wages
    private JTextField wageField; // Field to enter info for Wage
    private JTextArea textArea;
    private JButton enterButton; //Enter Button in GUI
    private JButton runReportsButton; // Run report in GUI
    private JButton quitButton; // Exit program button ...

Thank you so much! thats exactly what it was.

The GUi does function,in the sense the actions from the button does cause the program to do Something however it doesn't use the user input numbers. it uses two defauts so it always displays
total mintues are 1.0
Average Earnings are 1.0
Minimum wage is : Below Minimum Wage

I cant see the error within the Actionlistener method

Hi guys, i am writing a GUI program that will take a tutor minutes and earings and create an average earnings. My problem is instead of it using what we type in the fields E.g 200 mins and 50 dollars earnt and displaying the average. It shows the default fields. Please see attached code

import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;

public class Tutorhelp extends JFrame 
{
    private JPanel panel;
    private JLabel TutorTimeLabel;
    private JTextField timeField;
    private JLabel TutorWageLabel;
    private JTextField wageField;
    private JTextArea textArea;
    private JButton enterButton;
    private JButton runReportsButton;
    private JButton quitButton;
    final int WINDOW_WIDTH = 500;
    final int WINDOW_HEIGHT = 600;
    double [] tutorMin = new double [2];
    double [] tutorWage = new double [2];

    public Tutorhelp()
    {
        setTitle("Tutor Earnings");
        setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        buildPanel();
        add(panel);
        setVisible(true);

    }

    private void buildPanel()
    {
        TutorTimeLabel = new JLabel("Tutor Time");
        timeField = new JTextField(10);
        TutorWageLabel = new JLabel ("Tutor Earnings");
        wageField = new JTextField(10);
        textArea = new JTextArea(25,50);
        enterButton = new JButton("Enter");
        enterButton.addActionListener(new EnterButtonListener());
        runReportsButton = new JButton("Run Reports");
        runReportsButton.addActionListener(new runReportsButtonListener());
        quitButton = new JButton("Quit");
        quitButton.addActionListener(new quitButtonListener());
        panel = new JPanel();
        panel.add(TutorTimeLabel);
        panel.add(timeField);
        panel.add(TutorWageLabel);
        panel.add(wageField);
        panel.add(textArea);
        panel.add(enterButton);
        panel.add(runReportsButton);
        panel.add(quitButton);    
    }

    private class EnterButtonListener implements ActionListener
    {
        public void actionPerformed(ActionEvent e)
        {

        int count = 0;
        double num1 = 0;
        double num2 = 0;
        double m = Double.parseDouble(timeField.getText());
        double w = Double.parseDouble(wageField.getText());
        num1 = m ;
        num2 = w ;

        if (num1 <=0)
        {
            JOptionPane.showMessageDialog(null, "Please enter a time larger than 0", "Error",
                    JOptionPane.ERROR_MESSAGE);
        }else if (num1 > 240)
        {
            JOptionPane.showMessageDialog(null, ...