Methods - Need Help!

Please help with the following question...
Describe the structure of a typical method making reference to its accessibility, return value, passed parameters, its begin/end delimiters and the method call itself:
public void paint (int x, int y) {
paint(100, 100);
Explain the benefits of encasing a block of software code within a method.
Yours faithfully

ok, so i take it that you are not pleased that i
answered an obvious homework question.No, I just thought it was funny that he posted a question that sounded like he copied it verbatim from a homework assignment. So my joke was to post a question that sounds even more like a verbatim copy. Hahaha.
Re: helping students, I think it's appropriate in many cases. For example, when you're starting out it's easy to get tripped up on minor syntactical issues, and there's really no harm in pointing out errors like that.
Basically everything in computer science is arbitrary. That's the cool thing about it. But this also means that a beginner can be terribly lost, since for a given problem he may not know where to even start looking for information ... intuition can be frustratingly useless in many cases. It's always appropriate to tell someone what things are called and what terms they should be looking up in their manual. There's no shame in not knowing these things.
Also, if my experience was at all typical, college professors, and even TA's, can be annoying remote, unavailable, unhelpful, and even smug. (I've known profs and TA's who seemed to feel that if you asked them a question, then you weren't "cluefull", and therefore you didn't deserve to know the answer and by the way they're better than you. A friend of mine had to deal with a prof who informed him that he had to know a particular issue to pass the class, but he refused to teach it in class or even suggest references for independant study.) This wouldn't be so bad if the profs could write well so that all you were left with were a lot of footwork to do, but many profs can't be bothered to write their assignments in complete sentences or check for typos. Given that environment, I think it's fine if someone posts a opaque homework question and asks if someone can explain what it means exactly, for example.
I think the rule of thumb is that you want to encourage and reward natural curiosity, but not make things so easy that curiosity is never exercized. Maybe I'm saying this because I'm getting paternal in my old age.

Similar Messages

  • Switch method need help please ;-(

    Hello, I am having trouble with this switch method. I have yet ot construct the AirplaneList object "plane". For I have yet to be taught about it properly
    Can someone at least help me with the switch incident. I have learnt how to make a menu for the user to input the letters A-F in uppercase and lower case. However I am unsure on how to associate "case a" to the method
    //add Airplane
    public static void option1 (AirplaneList plane)
    ? I can get it to print out "case a" continueosly, but how to I associate it to the method. I am aware that the AirplaneList will be a class I have to define earlier, and that "plane" is an object I will need to intiate. If anyone will be willing to help me construct this part of the code I can award them Duke dollars.
    as far as I can tell the constructor method would start off like
    AirplaneList plane = new AirplaneList;
    ok? then what do I do?
    do I define its methods then?
    plane.add()
    Ok well this is the majority of the code I have already.
    import javax.swing.JOptionPane; //indicates that the compiler should load class JOptionPane for use in this application.
    public class AirplaneListT
         public static void main (String[] args)
    throws java.io.IOException
              char choice; //Words choice and size are the names of variables
         //     int size; //This declaration specifies that the variable are of data type char and int
         //     size = EasyIn.getInt(); // Converts size from int to something?
         //Char - a variable that may only hold a single lowercase letter, a single uppercase letter, a single digit or a special character
    //(such as x, $, 7 and *)
         // The code below creates a dialog box for the user to input a choice
         String inputcode;
         inputcode = JOptionPane.showInputDialog("A: add an airplane from the list\n" +
                                  "B: remove an airplane from the list\n" +
                                  "C: check if the list is empty\n" +
                                  "D: check if the list is full\n" +
                                  "E: display the list\n" +
                                  "F: quit\n" );
         JOptionPane.showMessageDialog(null, "You have chosen choice " + inputcode);
    //The null first argument indicates that the message dialog will appear in the center of the screen. The 2nd is the message to display
    do
         // get choice from user
         choice = inputcode.toUpperCase().charAt(0);
              System.out.println();
              //process menu options
              switch(choice)
                   case 'A':
                   case 'a':
                        JOptionPane.showMessageDialog(null, "Case " + inputcode);
                        break;     //done processing case
                   case 'B':
                   case 'b':
                        JOptionPane.showMessageDialog(null, "Case " + inputcode);
                        break;     //done processing case
                   case 'C':
                   case 'c':
                        JOptionPane.showMessageDialog(null, "Case " + inputcode);
                        break;     //done processing case
                   case 'D':
                   case 'd':
                        JOptionPane.showMessageDialog(null, "Case " + inputcode);
                        break;     //done processing case
                   case 'E':
                   case 'e':
                        JOptionPane.showMessageDialog(null, "Case " + inputcode);
                        break;     //done processing case
                   case 'F':
                   case 'f':
                        JOptionPane.showMessageDialog(null, "Case " + inputcode);
                        break;     //done processing case
                   default:
                        JOptionPane.showMessageDialog(null, "Invalid entry!");
                        break;     //done processing case
         }while (choice!= 'F' || //end AirplaneList tester
         choice!= 'f' );
    //add Airplane
         public static void option1 (AirplaneList plane)
              String flight;
              flight = JOptionPane.showInputDialog("Please enter airplane filght number" );
              //create an Airplane object to add to list
              Airplane flight = new Airplane();
              //add string to list if the list is not full
              //access the 'add(Airplane)' method from the AirplaneList class;
              //if the list is full, return a statement to the user indicating that no more plane can be added onto the list
         //remove airplane
         public static void option2 ()
              //get position of item
         string enterpos;
         enterpos = JOptionPane.showInputDialog("Please enter position to remove" );
              System.out.print(":")
              int plane = Easyln.getint();
              // delete item if it exists
              //access the 'remove(Airplane)' method from the AirplaneList class;
              //if the user enter an invalid number for the position, returen a statement
              //indicating that there is no such posititon.
         //check if empty
         public static void option3 (AirplaneList plane)
              if (plane.isEmpty())
                   JOptionPane.showInputDialog("list is empty" );
              else
                   JOptionPane.showInputDialog("list is not empty" );
         //check if full
         public static void option4 (AirplaneList plane)
              if (plane.isFull())
                   JOptionPane.showInputDialog("list is full" );
              else
                   JOptionPane.showInputDialog("list is not full" );
         //display list
         public static void option5 (AirplaneList plane)
              if (plane.isEmpty())     //no need to display if list is empty
                   JOptionPane.showInputDialog("list is empty" );
              else
                   JOptionPane.showInputDialog("Airplanes in list are" );
                   //loop through list
         System.exit(0); //Terminates the program

    case 'A':
    case 'a':
    JOptionPane.showMessageDialog(null, "Case " + " + inputcode);
    break;     //done processing case
    ok are u saying if i invoke a method i go something
    like this?
    case 'A':
    case 'a':
    JOptionPane.showMessageDialog(null, "Case " + " + inputcode);
    AirplaneList.option1(); //Tell Airplanelist to add                    
    break;     //done processing caseIn both cases, you're calling methods. In the latter case, you're calling two methods.
    What's the problem exactly? What part are you having trouble with?
    ... so that then when case a is activated it should go
    onto option1 method?That's one thing you can do, yes. I don't know if you should do it. It depends on what your program needs to do.
    //add Airplane
         public static void option1 (AirplaneList plane)
              String flight;
    flight = JOptionPane.showInputDialog("Please enter
    r airplane filght number" );
              //create an Airplane object to add to list
              Airplane flight = new Airplane();
              //add string to list if the list is not full
    //access the 'add(Airplane)' method from the
    e AirplaneList class;
    //if the list is full, return a statement to the
    e user indicating that no more plane can be added onto
    the list
         }OK, this looks odd. Is this what you're having trouble with?
    BTW, I'd strongly suggest making a stronger separation of application code from GUI code.

  • This sign appeared in my account: "Your payment method was declined. Update your biiling info'. After adding new information about my others cards I see the same sign. Can't understand what the problem is and what should I do. Need help!!!

    This sign appeared in my account: "Your payment method was declined. Update your biiling info'. After adding new information about my others cards I see the same sign. Can't understand what the problem is and what should I do. Everything used to be good before.
    Do anyone know what I supposed to do in that situation?
    Really need help!
    Thanks in advance.

    Contact iTunes Customer Service and request assistance
    Use this Link  >  Apple  Support  iTunes Store  Contact

  • Need Help with a getText method

    Gday all,
    I need help with a getText method, i need to extract text from a JTextField. Although this text then needs to converted to a double so that i can multiply a number that i have already specified. As you may of guessed that the text i need to extract already will be in a double format.e.g 0.1 or 0.0000004 etc
    Thanks for your help
    ps heres what i have already done its not very good though
    ToBeConverted.getText();
    ( need help here)
    double amount = (and here)
    total = (amount*.621371192);
    Converted.setText("= " + total);

    Double.parseDouble( textField.getText() );

  • Need help in the String Format method

    really need help in string.Format method. I would like to show the s in two digit numbers.
    for example:
    if s is below 10 then display *0s*
    the expecting result is 01,02,03.. 09,10,11....
    I tried this method, somehow i got the errors msg. pls advise. thx.
    public void setDisplay(String s) {
    String tmpSS=String.format("%02d",s);
    this.ss.setText(tmpSS);
    Edited by: bluesailormoon on May 19, 2008 10:30 AM

    Apparently, you expect the string to consist of one or two digits. If that's true, you could do this:String tmpSS = (s.length() == 1) ? ("0" + s) : s; or this: String tmpSS = String.format("%02d", Integer.parseInt(s));

  • Need help with Sound Methods

    Hi, I am new to java and need help with sound methods.
    q: create a new method that will halve the volume of the positive values and double the volume of the negative values.
    Message was edited by:
    Apaula30

    duplicate message #2

  • Need Help with MemoSaver2 with pop up and reverse method

    I am working on this program and need help bad. I cant get the pop up work. I know I have the JOption method wrong and I also need my reverse button to print in reverse. I keep getting errors with these portions.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class MemoSaver2 extends JFrame implements ActionListener
    public static final int WIDTH = 700;
    public static final int HEIGHT = 300;
    public static final int LINES = 10;
    public static final int CHAR_PER_LINE = 40;
    private JTextArea theText;
    private String memo1 = "No Memo 1.";
    private String memo2 = "No Memo 2.";
         private String memo3 = "No Memo 3.";
         private String reverse = "Reverse";
    public MemoSaver2()
    setSize(WIDTH, HEIGHT);
    WindowDestroyer listener = new WindowDestroyer();
    addWindowListener(listener);
    setTitle("Memo Saver 2");
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());
    JPanel buttonPanel = new JPanel();
    buttonPanel.setBackground(Color.white);
    buttonPanel.setLayout(new GridLayout(3,3));
    JButton memo1Button = new JButton("Save Memo 1");
    memo1Button.addActionListener(this);
    buttonPanel.add(memo1Button);
    JButton memo2Button = new JButton("Save Memo 2");
    memo2Button.addActionListener(this);
    buttonPanel.add(memo2Button);
    JButton clearButton = new JButton("Clear");
    clearButton.addActionListener(this);
    buttonPanel.add(clearButton);
    JButton get1Button = new JButton("Get Memo 1");
    get1Button.addActionListener(this);
    buttonPanel.add(get1Button);
    JButton get2Button = new JButton("Get Memo 2");
    get2Button.addActionListener(this);
    buttonPanel.add(get2Button);
    JButton exitButton = new JButton("Exit");
    exitButton.addActionListener(this);
    buttonPanel.add(exitButton);
              JButton reverseButton = new JButton("Reverse");
              reverseButton.addActionListener(this);
              buttonPanel.add(reverseButton);
              JButton myNameButton = new JButton("My Name");
              myNameButton.addActionListener(this);
              buttonPanel.add(myNameButton);
              JButton myInfoButton = new JButton("My Info");
              myInfoButton.addActionListener(this);
              buttonPanel.add(myInfoButton);
    contentPane.add(buttonPanel, BorderLayout.SOUTH);
    JPanel textPanel = new JPanel();
    textPanel.setBackground(Color.blue);
    theText = new JTextArea(LINES, CHAR_PER_LINE);
    theText.setBackground(Color.white);
    theText.setLineWrap(true);
    textPanel.add(theText);
    contentPane.add(textPanel, BorderLayout.CENTER);
    public void actionPerformed(ActionEvent e)
    String actionCommand = e.getActionCommand();
    if (actionCommand.equals("Save Memo 1"))
    memo1 = theText.getText();
    theText.setText("Memo 1 saved.");
    else if (actionCommand.equals("Save Memo 2"))
    memo2 = theText.getText();
    theText.setText("Memo 2 saved.");
    else if (actionCommand.equals("Clear"))
    theText.setText("");
    else if (actionCommand.equals("Get Memo 1"))
    theText.setText(memo1);
    else if (actionCommand.equals("Get Memo 2"))
    theText.setText(memo2);
    else if (actionCommand.equals("Exit"))
         System.exit(0);
              else if(actionCommand.equals(" Get reverse"))
                   memo3 = theText.getText();
                   theText.setText("");
              else if(actionCommand.equals("Get My Name"))
                        String memo4;
                        String=JOption.showInputDialog("Kim Clark");
                        /*theText = theText.getText();*/
              else if(actionCommand.equals("My Info"))
                   theText.setText("Kim Clark [email protected]");
    else
    theText.setText("Error in memo interface");
    private String reverse(String reverseMe);
              StringBufffer sb = new StringBuffer(reverseMe);
              return sb.reverse().toString();
         public static void main(String[] args)
    MemoSaver2 guiMemo = new MemoSaver2();
    guiMemo.setVisible(true);
         public class WindowDestroyer extends WindowAdapter
                   public void windowClosing(WindowEvent e)
                        System.exit(0);
         }

    ... I keep getting errors with these portions.Darn, that's a shame. Good luck with that. In the meantime, you might want to consider asking specific questions other than just plopping your code here and sitting idly hoping someone just fixes it for you.

  • Good evening. needed help. I created an account on my ipad on itunes. then wanted to add a credit card the Mbnet. the problem is that an error appears saying "payment method rejected

    I
    good evening. needed help. I created an account on my ipad on itunes. then wanted to add a credit card the Mbnet. the problem is that an error appears saying "payment method rejected"Can help me?

    iTunes Store: Accepted forms of payment
    Mbnet (virtual) is not acceptable form of payment.

  • Need help with calling method

    I'm new to Java, trying to pass a required class so I can graduate this semester, and I need help figuring out what is wrong with the code below. My assignment is to create a program to convert celsius to fahrenheit and vice versa using Scanner for input. The program must contain 3 methods - main, convert F to C, method, and convert C to F method. Requirements of the conversion methods are one parameter which is an int representing temp, return an int representing calculated temp after doing appropriate calculation, should not display info to user, and should not take in info from user.
    The main method is required to ask the user to input a 1 for converting F to C, 2 for C to F, and 3 to end the program. It must include a while loop that loops until the user enters a 3, ask the user to enter a temp, call the appropriate method to do the conversion, and display the results. I'm having trouble calling the conversion methods and keep getting the following 2 compiler errors:
    cannot find symbol
    symbol : method farenheitToCelsius(int)
    location: class WondaPavoneTempConverter
    int celsius = farenheitToCelsius(intTemp);
    ^
    cannot find symbol
    symbol : method celsiusToFarenheit(int)
    location: class WondaPavoneTempConverter
    int farenheit = celsiusToFarenheit(intTemp);
    The code is as follows:
    public static void main(String[] args) {
    // Create a scanner
    Scanner scanner = new Scanner(System.in);
    // Prompt the user to enter a temperature
    System.out.println("Enter the temperature you wish to convert as a whole number: ");
    int intTemp = scanner.nextInt();
    System.out.println("You entered " + intTemp + " degrees.");
    // Prompt the user to enter "1" to convert to Celsius, "2" to convert to
    // Farenheit, or "3" to exit the program
    System.out.println("Enter 1 to convert to Celsius, 2 to convert to Farenheit, or 3 to exit.");
    int intConvert = scanner.nextInt();
    // Convert temperature to Celsius or Farenheit
    int celsius = farenheitToCelsius(intTemp);
    int farenheit = celsiusToFarenheit(intTemp);
    while (intConvert >= 0) {
    // Convert to Celsius
    if (intConvert == 1) {
    System.out.println("Celsius is " + celsius + " degrees.");
    // Convert to Farenheit
    else if (intConvert == 2) {
    System.out.println("Farenheit is " + farenheit + " degrees.");
    // Exit program
    else if (intConvert == 3) {
    break;
    else {
    System.out.println("The number you entered is invalid. Please enter 1, 2, or 3.");
    //Method to convert Celsius to Farenheit
    public static int celsiusToFahrenheit(int cTemp) {
    return (9 / 5) * (cTemp + 32);
    //Method to convert Farenheit to Celsius
    public static int fahrenheitToCelsius(int fTemp) {
    return (5 / 9) * (fTemp - 32);
    I readily admit I'm a complete dunce when it comes to programming - digital media is my area of expertise. Can anyone point me in the right direction? This assignment is due very soon. Thanks.

    1) consider using a boolean variable in the while statement and converting it to true if the input is good.
    while (inputNotValid)
    }2) put the code to get the input within the while loop. Try your code right now and enter the number 30 when your menu requests for input and you'll see the infinite loop.... and why you need to request input within the loop.
    3) Fix your equations. You are gonig to have to do some double calcs, even if you convert it back to int for the method return. Otherwise the results are just plain wrong. As a good test, put in the numbers -40, 0, 32, 100, and 212. Are the results as expected? (-40 is the only temp that is the same for both cent and fahr). I recommend doing double calcs and then casting the result to int in the return. for example:
    int a = (int) (20 + 42.0 / 3);  // the 42.0 forces the compiler to do double calc.4) One of your equations may still be plain wrong even with this fix. Again, run the test numbers and see.
    5) Also, when posting your code, please use code tags so that your code will be well-formatted and readable. To do this, either use the "code" button at the top of the forum Message editor or place the tag [code] at the top of your block of code and the tag [/code] at the bottom, like so:
    [code]
      // your code block goes here.
    [/code]

  • Need help with method... wrote an addition program... have most of it

    Writing an addition program... have most of it below. Need help in getting the program to work.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Ch10program2 extends JFrame implements ActionListener
    private static final int FRAME_WIDTH = 750;
    private static final int FRAME_HEIGHT = 150;
    private static final int BUTTON_HEIGHT = 50;
    private static final int BUTTON_WIDTH = 50;
    private static final int BUTTON_Y_POSITION = 50;
    private static final String EMPTY_STRING = "";
    private int XbuttonPosition = 15;
    private JButton[] button;
    private String[] buttonLabels = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "=", "c"};
    private JTextField mytextfield;
    private int[] numberOne;
    private int[] numberTwo;
    private int[] sum;
    private int numberCounter = 0;
    private boolean adding = false;
    public static void main (String[] args)
    Ch10program2 frame = new Ch10program2 ();
    frame.setVisible (true);
    public Ch10program2 ()
    Container contentPane = getContentPane ();
    // set the frame properties
    setSize (FRAME_WIDTH, FRAME_HEIGHT);
    setLocation (200, 200);
    setTitle ("Big Integer Adder");
    setResizable (false);
    //set the content pane properties
    contentPane.setLayout (null);
    //creating each button
    button = new JButton [13];
    for (int i = 0 ; i < button.length ; i++)
    button = new JButton (buttonLabels [i]);
    button [i].setBounds (XbuttonPosition, BUTTON_Y_POSITION, BUTTON_WIDTH, BUTTON_HEIGHT);
    XbuttonPosition += 55;
    button [i].setForeground (Color.blue);
    if (i > 9)
    button [i].setForeground (Color.red);
    contentPane.add (button [i]);
    button [i].addActionListener (this);
    //set the arrays
    numberOne = new int [50];
    numberTwo = new int [50];
    //set the needed textfield
    mytextfield = new JTextField ("");
    mytextfield.setBounds (10, 10, 720, 25);
    mytextfield.setBorder (BorderFactory.createLoweredBevelBorder ());
    mytextfield.setHorizontalAlignment (JTextField.RIGHT);
    contentPane.add (mytextfield);
    setDefaultCloseOperation (EXIT_ON_CLOSE);
    public void actionPerformed (ActionEvent event)
    JButton clickedButton = (JButton) event.getSource ();
    String oldText = mytextfield.getText ();
    if ((event.getActionCommand ()).equals ("+"))
    mytextfield.setText (oldText + " + ");
    adding = true;
    numberCounter = 0;
    else if ((event.getActionCommand ()).equals ("="))
    mytextfield.setText (oldText + " = ");
    addArrays ();
    displayArray ();
    else if ((event.getActionCommand ()).equals ("c"))
    clearText ();
    else if (adding == false)
    mytextfield.setText (oldText + event.getActionCommand ());
    if (numberCounter == 0)
    numberOne [numberCounter] = Integer.parseInt (event.getActionCommand ());
    else
    for (int i = numberOne.length - 1 ; i > 0 ; i--)
    numberOne [i] = numberOne [i - 1];
    numberOne [0] = Integer.parseInt (event.getActionCommand ());
    numberCounter++;
    else
    mytextfield.setText (oldText + event.getActionCommand ());
    if (numberCounter == 0)
    numberTwo [numberCounter] = Integer.parseInt (event.getActionCommand ());
    else
    for (int i = numberTwo.length - 1 ; i > 0 ; i--)
    numberTwo [i] = numberTwo [i - 1];
    numberTwo [0] = Integer.parseInt (event.getActionCommand ());
    numberCounter++;
    oldText = mytextfield.getText ();
    public void addArrays ()
    int temp = 0;
    int carriedDigit = 0;
    for (int i = 0 ; i < 50 ; i++)
    temp = carriedDigit + numberOne [i] + numberTwo [i];
    if (temp > 10)
    sum [i] = (temp - 10);
    carriedDigit = 1;
    else
    sum [i] = temp;
    public void displayArray ()
    private void clearText ()
    mytextfield.setText (EMPTY_STRING);

    I don't know what you want to do
    but i have taken your program to get the GUI then the logic is your's
    You try solving it.
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Ch10program2 extends JFrame implements ActionListener
    private static final int FRAME_WIDTH = 750;
    private static final int FRAME_HEIGHT = 150;
    private static final int BUTTON_HEIGHT = 50;
    private static final int BUTTON_WIDTH = 50;
    private static final int BUTTON_Y_POSITION = 50;
    private static final String EMPTY_STRING = "";
    private int XbuttonPosition = 15;
    private JButton[] button;
    private String[] buttonLabels = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "+", "=", "c"};
    private JTextField mytextfield;
    private int[] numberOne;
    private int[] numberTwo;
    private int[] sum;
    private int numberCounter = 0;
    private boolean adding = false;
    public static void main (String[] args)
    Ch10program2 frame = new Ch10program2 ();
    frame.setVisible (true);
    public Ch10program2 ()
    Container contentPane = getContentPane ();
    // set the frame properties
    setSize (FRAME_WIDTH, FRAME_HEIGHT);
    setLocation (200, 200);
    setTitle ("Big Integer Adder");
    setResizable (false);
    //set the content pane properties
    contentPane.setLayout (null);
    //creating each button
    button = new JButton [13];
    for (int i = 0 ; i < button.length ; i++)
    button[i] = new JButton (buttonLabels);
    button[i].setBounds (XbuttonPosition, BUTTON_Y_POSITION, BUTTON_WIDTH, BUTTON_HEIGHT);
    XbuttonPosition += 55;
    button[i].setForeground (Color.blue);
    if (i > 9)
    button[i].setForeground (Color.red);
    contentPane.add (button[i]);
    button[i].addActionListener (this);
    //set the arrays
    numberOne = new int [50];
    numberTwo = new int [50];
    //set the needed textfield
    mytextfield = new JTextField ("");
    mytextfield.setBounds (10, 10, 720, 25);
    mytextfield.setBorder (BorderFactory.createLoweredBevelBorder ());
    mytextfield.setHorizontalAlignment (JTextField.RIGHT);
    contentPane.add (mytextfield);
    setDefaultCloseOperation (EXIT_ON_CLOSE);
    public void actionPerformed (ActionEvent event)
    JButton clickedButton = (JButton) event.getSource ();
    String oldText = mytextfield.getText ();
    if ((event.getActionCommand ()).equals ("+"))
    mytextfield.setText (oldText + " + ");
    adding = true;
    numberCounter = 0;
    else if ((event.getActionCommand ()).equals ("="))
    mytextfield.setText (oldText + " = ");
    addArrays ();
    displayArray ();
    else if ((event.getActionCommand ()).equals ("c"))
    clearText ();
    else if (adding == false)
    mytextfield.setText (oldText + event.getActionCommand ());
    if (numberCounter == 0)
    numberOne [numberCounter] = Integer.parseInt (event.getActionCommand ());
    else
    for (int i = numberOne.length - 1 ; i > 0 ; i--)
    numberOne[i] = numberOne [i - 1];
    numberOne [0] = Integer.parseInt (event.getActionCommand ());
    numberCounter++;
    else
    mytextfield.setText (oldText + event.getActionCommand ());
    if (numberCounter == 0)
    numberTwo [numberCounter] = Integer.parseInt (event.getActionCommand ());
    else
    for (int i = numberTwo.length - 1 ; i > 0 ; i--)
    numberTwo[i] = numberTwo [i - 1];
    numberTwo [0] = Integer.parseInt (event.getActionCommand ());
    numberCounter++;
    oldText = mytextfield.getText ();
    public void addArrays ()
    int temp = 0;
    int carriedDigit = 0;
    for (int i = 0 ; i < 50 ; i++)
    temp = carriedDigit + numberOne[i] + numberTwo[i] ;
    if (temp > 10)
    sum[i] = (temp - 10);
    carriedDigit = 1;
    else
    sum[i] = temp;
    public void displayArray ()
    private void clearText ()
    mytextfield.setText (EMPTY_STRING);
    All The Best

  • Need help getting these methods to work

    this program consists three seperate classes. i have two of the three working, i just can't figure out this one. here is my code, and the pseudo code for the methods. any help would be greatly appreciated. i am getting the following 18 errors
    CheckingAccountsTest.java:35: getAccountType(java.lang.String) in CheckingAccount cannot be applied to ()
    if(myFields[indexForAccountType].equals(CheckingAccount.getAccountType())){ //A-1-2-10
    ^
    CheckingAccountsTest.java:45: cannot find symbol
    symbol : constructor CheckingAccountPlus(java.lang.String,java.lang.String,java.lang.String,double)
    location: class CheckingAccountPlus
    CheckingAccountPlus currentAccount = new CheckingAccountPlus(myFields[indexForAccountId], //A-1-2-17 THROUGH A-1-2-20
    ^
    CheckingAccountsTest.java:72: getAccountId(java.lang.String) in CheckingAccount cannot be applied to ()
    currentAccount.getAccountId().equals(myFields[indexForAccountId]); //A-1-3-06
    ^
    CheckingAccountsTest.java:124: cannot find symbol
    symbol : method makeDeposit(double)
    location: class CheckingAccountPlus
    currentAccount.makeDeposit(amount); //A-1-6-02
    ^
    CheckingAccountsTest.java:161: getAccountId(java.lang.String) in CheckingAccount cannot be applied to ()
    currentAccount, currentAccount.getAccountId(), CheckingAccount.getAccountType(), currentAccount.getBalance());
    ^
    CheckingAccountsTest.java:161: getAccountType(java.lang.String) in CheckingAccount cannot be applied to ()
    currentAccount, currentAccount.getAccountId(), CheckingAccount.getAccountType(), currentAccount.getBalance());
    ^
    CheckingAccountsTest.java:167: non-static method getAccountType() cannot be referenced from a static context
    currentAccount, currentAccount.getAccountId(), CheckingAccountPlus.getAccountType(), currentAccount.getBalance());
    ^
    CheckingAccountsTest.java:171: getAccountId(java.lang.String) in CheckingAccount cannot be applied to ()
    System.out.printf("Account Totals", currentAccount.getAccountId(), CheckingAccount.getAccountType(), //A-1-11-01
    ^
    CheckingAccountsTest.java:171: getAccountType(java.lang.String) in CheckingAccount cannot be applied to ()
    System.out.printf("Account Totals", currentAccount.getAccountId(), CheckingAccount.getAccountType(), //A-1-11-01
    ^
    CheckingAccountsTest.java:172: getBeginningBalance(double) in CheckingAccount cannot be applied to ()
    currentAccount.getBeginningBalance(), currentAccount.getDeposits(), currentAccount.getWithdrawals(), //A-1-11-02
    ^
    CheckingAccountsTest.java:172: getDeposits(double) in CheckingAccount cannot be applied to ()
    currentAccount.getBeginningBalance(), currentAccount.getDeposits(), currentAccount.getWithdrawals(), //A-1-11-02
    ^
    CheckingAccountsTest.java:172: getWithdrawals(double) in CheckingAccount cannot be applied to ()
    currentAccount.getBeginningBalance(), currentAccount.getDeposits(), currentAccount.getWithdrawals(), //A-1-11-02
    ^
    CheckingAccountsTest.java:173: getFees(double) in CheckingAccount cannot be applied to ()
    currentAccount.getFees(), currentAccount.getBalance(), currentAccount.getOverdrafts(), " *"); //A-1-11-03 THROUGH A-1-11-04
    ^
    CheckingAccountsTest.java:173: getOverdrafts(double) in CheckingAccount cannot be applied to ()
    currentAccount.getFees(), currentAccount.getBalance(), currentAccount.getOverdrafts(), " *"); //A-1-11-03 THROUGH A-1-11-04
    ^
    CheckingAccountsTest.java:178: getAccountType(java.lang.String) in CheckingAccount cannot be applied to ()
    System.out.printf("Account Totals", currentAccount.getAccountId(), CheckingAccount.getAccountType(), //A-1-12-01
    ^
    CheckingAccountsTest.java:179: cannot find symbol
    symbol : method getBeginningBalance()
    location: class CheckingAccountPlus
    currentAccount.getBeginningBalance(), currentAccount.getDeposits(), currentAccount.getWithdrawals(), //A-1-12-02
    ^
    CheckingAccountsTest.java:179: cannot find symbol
    symbol : method getDeposits()
    location: class CheckingAccountPlus
    currentAccount.getBeginningBalance(), currentAccount.getDeposits(), currentAccount.getWithdrawals(), //A-1-12-02
    ^
    CheckingAccountsTest.java:180: cannot find symbol
    symbol : method getSumOfCreditCardAdvances()
    location: class CheckingAccountPlus
    currentAccount.getBalance(), currentAccount.getSumOfCreditCardAdvances(), " *"); //A-1-12-03 THROUGH A-1-12-04
    ^
    18 errors
    Process completed.
    public class CheckingAccountsTest
         private static final int indexForAccountId = 0;
         private static final int indexForAccountType = 2;
         private static final int indexForBalance = 5;
         private static final int indexForDepositAmount = 2;
         private static final int indexForFirstName = 3;
         private static final int indexForLastName = 4;
         private static final int indexForRecordType = 1;
         private static final int indexForWithdrawalAmount = 2;
         private static final String recordTypeForDeposit = "CKD";
         private static double sumOfBeginningBalances = 0.0;
         private static double sumOfCreditCardAdvances = 0.0;
         private static double sumOfDeposits = 0.0;
         private static double sumOfEndingBalances = 0.0;
         private static double sumOfFees = 0.0;
         private static double sumOfOverdrafts = 0.0;
         private static double sumOfWithdrawals = 0.0;
    public static void main(String args[])
         MyCsvFile myFile = new MyCsvFile("monthlyBankTransactions,v05.txt"); //A-1-2-01 THRU A-1-2-02
         System.out.println("\nBig Bank: Monthly Checking Account Activity\n"); //A-1-2-04
         System.out.println("----------- Account ----------- Beginning\t\t    With-\t\t   Ending\tOver-\tCredit Cd"); //A-1-2-05
         System.out.println("     Name\t   Id    Type\t Balance   +   Deposit   -  drawal   -    Fee   =  Balance\tdraft\t Advance\n"); //A-1-2-06
         myFile.readARecord(); //A-1-2-07
         while(myFile.getEofFound() == false) //A-1-2-08
              String []myFields = myFile.getCsvRecordFieldArray();//A-1-2-09
              if(myFields[indexForAccountType].equals(CheckingAccount.getAccountType())){ //A-1-2-10
             CheckingAccount currentAccount = new CheckingAccount(myFields[indexForAccountId], //A-1-2-11 THROUGH A-1-2-12
             myFields[indexForFirstName], myFields[indexForLastName],
             Double.parseDouble(myFields[indexForBalance])); //A-1-2-13
             handleAccount(currentAccount, myFile, myFields); //A-1-2-14
             currentAccount = null;// A-1-2-15
        else//A-1-2-16
             CheckingAccountPlus currentAccount = new CheckingAccountPlus(myFields[indexForAccountId], //A-1-2-17 THROUGH A-1-2-20
             myFields[indexForFirstName], myFields[indexForLastName], Double.parseDouble(myFields[indexForBalance]));
             handleAccount(currentAccount, myFile, myFields);
             currentAccount = null; //A-1-2-21
        }//end if A-1-2-22
    }//end while A-1-2-23
         System.out.printf("Report Totals", sumOfBeginningBalances,sumOfDeposits, //A-1-2-24
         sumOfWithdrawals, sumOfFees, sumOfEndingBalances, sumOfOverdrafts, sumOfCreditCardAdvances, "**"); //A-1-2-25
         System.out.printf("The information in the above report is from the 17 records in the following file:",
         myFile.getCountOfRecords());                                                                           //A-1-2-26
         System.out.printf("Path to file:", myFile.getFilePath()); //A-1-2-27
         System.out.printf("Name of file:", myFile.getFileName()); //A-1-2-28
         System.out.println("\nEnd of program"); //A-1-2-29
    }// end main method
    public static void handleAccount(CheckingAccount currentAccount, MyCsvFile myFile, String []myFields)
         sumOfBeginningBalances += currentAccount.getBalance(); //A-1-3-01
         printBeginningBalance(currentAccount); // A-1-3-02
         myFile.readARecord(); //A-1-3-03
         myFields = myFile.getCsvRecordFieldArray(); //A-1-3-04
    while (myFile.getEofFound() == false) //A-1-3-05
       currentAccount.getAccountId().equals(myFields[indexForAccountId]); //A-1-3-06
    if(myFields[indexForRecordType].equals(recordTypeForDeposit)){ //A-1-3-07
         handleDeposit(currentAccount, Double.parseDouble(myFields[indexForDepositAmount])); //A-1-3-08 THROUGH A-1-3-09
          else //A-1-3-10
          handleWithdrawal(currentAccount,Double.parseDouble(myFields[indexForWithdrawalAmount])); //A-1-3-11 THROUGH A-1-3-12
       }//end if //A-1-3-13
    myFile.readARecord();//A-1-3-14
    myFields = myFile.getCsvRecordFieldArray(); //A-1-3-15 THROUGH A-1-3-16
    }//end while //A-1-3-17
    sumOfEndingBalances += currentAccount.getBalance();//A-1-3-18
    printEndingBalance(currentAccount); //A-1-3-19
    public static void handleAccount(CheckingAccountPlus currentAccount, MyCsvFile myFile, String [] myFields)
    sumOfBeginningBalances += currentAccount.getBalance(); //A-1-4-01
    printBeginningBalance(currentAccount); //A-1-4-02
    myFile.readARecord(); //A-1-4-03
    myFields = myFile.getCsvRecordFieldArray(); //A-1-4-04
      while (myFile.getEofFound()==false) //A-1-4-05
    currentAccount.getAccountId().equals (myFields[indexForAccountId]); //A-1-4-06
    if(myFields[indexForRecordType].equals(recordTypeForDeposit)){ //A-1-4-07
         handleDeposit(currentAccount, Double.parseDouble(myFields[indexForDepositAmount])); //A-1-4-08 THROUGH //A-1-4-09
          else //A-1-4-10
          handleWithdrawal(currentAccount,Double.parseDouble(myFields[indexForWithdrawalAmount])); //A-1-4-11 THROUGH A-1-4-12
       }//end if A-1-4-13
    myFile.readARecord(); //A-1-4-14
    myFields = myFile.getCsvRecordFieldArray(); //A-1-4-15 THROUGH A-1-4-16
    }//end while A-1-4-17
    sumOfEndingBalances += currentAccount.getBalance(); //A-1-4-18
    printEndingBalance(currentAccount); //A-1-4-19
    private static void handleDeposit(CheckingAccount currentAccount, double amount)
    sumOfDeposits += amount; //A-1-5-01
    currentAccount.makeDeposit(amount); //A-1-5-02
    System.out.printf("$,%.2f", amount); //A-1-5-03
      private static void handleDeposit(CheckingAccountPlus currentAccount, double amount)
      sumOfDeposits += amount;//A-1-6-01
      currentAccount.makeDeposit(amount); //A-1-6-02
      System.out.printf("$,%.2f", amount); //A-1-6-03
      private static void handleWithdrawal(CheckingAccount currentAccount, double amount)
      if (currentAccount.makeWithdrawal(amount) == true){ //A-1-7-01
       sumOfWithdrawals += amount; //A-1-7-02
       System.out.printf("$,%.2f", amount); //A-1-7-03
      }else{ //A-1-7-04
       double overdraftFee = currentAccount.getOverdraftFee(); //A-1-7-05
       sumOfFees += overdraftFee; //A-1-7-06
       sumOfOverdrafts += amount; //A-1-7-07
       System.out.printf("$,%.2f",overdraftFee, amount); //A-1-7-08
      }//end if A-1-7-09
      private static void handleWithdrawal(CheckingAccountPlus currentAccount, double amount)
           if (currentAccount.makeWithdrawal(amount) == true){ //A-1-8-01
            sumOfWithdrawals += amount; //A-1-8-02
            System.out.printf("$,%.2f",amount); //A-1-8-03
      }else{ //A-1-8-04
       double creditCardAdvance = currentAccount.getCreditCardAdvance(); //A-1-8-05 THROUGH A-1-8-06
       sumOfCreditCardAdvances += creditCardAdvance; //A-1-8-07
       sumOfWithdrawals += currentAccount.getActualWithdrawal(); //A-1-8-08
       System.out.printf("$,%.2f",currentAccount.getActualWithdrawal(),creditCardAdvance); //A-1-8-09
      }//end if //A-1-8-10
    private static void printBeginningBalance(CheckingAccount currentAccount)
    System.out.printf("",   //A-1-9-01 THROUGH A-1-9-02
       currentAccount, currentAccount.getAccountId(), CheckingAccount.getAccountType(), currentAccount.getBalance());
    private static void printBeginningBalance(CheckingAccountPlus currentAccount)
    System.out.printf("",   //A-1-10-01 TROUGH A-1-10-02
       currentAccount, currentAccount.getAccountId(), CheckingAccountPlus.getAccountType(), currentAccount.getBalance());
    private static void printEndingBalance(CheckingAccount currentAccount)
      System.out.printf("Account Totals", currentAccount.getAccountId(), CheckingAccount.getAccountType(), //A-1-11-01
        currentAccount.getBeginningBalance(), currentAccount.getDeposits(), currentAccount.getWithdrawals(), //A-1-11-02
        currentAccount.getFees(), currentAccount.getBalance(), currentAccount.getOverdrafts(), " *"); //A-1-11-03 THROUGH A-1-11-04
    private static void printEndingBalance(CheckingAccountPlus currentAccount)
      System.out.printf("Account Totals", currentAccount.getAccountId(), CheckingAccount.getAccountType(), //A-1-12-01
        currentAccount.getBeginningBalance(), currentAccount.getDeposits(), currentAccount.getWithdrawals(), //A-1-12-02
        currentAccount.getBalance(), currentAccount.getSumOfCreditCardAdvances(), " *"); //A-1-12-03 THROUGH A-1-12-04
    }PSEUDO CODE FOR ALL METHODS
    This public static method has no return value and has one parameter of type String named args[ ], an array
    A-1-2-01)     INSTANTIATE a local variable named myFile of class MyCsvFile, passing a single String argument for the CSV filename:
    A-1-2-02)          ?monthlyBankTransactions,v05.txt?
    A-1-2-03)     DISPLAY the task / programmer identification line
    A-1-2-04)     DISPLAY the ?Big Bank: Monthly Checking Account Activity? title line
    A-1-2-05)     DISPLAY the first column heading line: ?---------- Account ----------??
    A-1-2-06)     DISPLAY the second column heading line: ? Name Id??
    A-1-2-07)     Get 1st record from CSV file using method readARecord: MyCsvFile class: myFile.readARecord()
    A-1-2-08)     WHILE (myFile.getEofFound() IS FALSE)
    A-1-2-09)          DEFINE a String Array named myFields, and ASSIGN it the value myFile.getCsvRecordFieldArray()
    A-1-2-10)          IF (myFields[indexForAccountType].equals(CheckingAccount.getAccountType()))
    A-1-2-11)               INSTANTIATE a local variable named currentAccount of class CheckingAccount, passing the following arguments:
    A-1-2-12)                    myFields[indexForAccountId], myFields[indexForFirstName], myFields[indexForLastName],
    A-1-2-13)                    Double.parseDouble(myFields[indexForBalance])
    A-1-2-14)               CALL method handleAccount of this class, passing the following arguments: currentAccount, myFile, myFields
    A-1-2-15)               ASSIGN null TO currentAccount
    A-1-2-16)          ELSE
    A-1-2-17)     INSTANTIATE a local variable named currentAccount of class CheckingAccountPlus, passing the following arguments:
    A-1-2-18)          myFields[indexForAccountId], myFields[indexForFirstName], myFields[indexForLastName],
    A-1-2-19)          Double.parseDouble(myFields[indexForBalance])
    A-1-2-20)     CALL method handleAccount of this class, passing the following arguments: currentAccount, myFile, myFields
    A-1-2-21)               ASSIGN null TO currentAccount
    A-1-2-22)          END IF
    A-1-2-23)     END WHILE
    A-1-2-24)     DISPLAY the report-total line using the following arguments: ?Report Totals?, sumOfBeginningBalances, sumOfDeposits,
    A-1-2-25)          sumOfWithdrawals, sumOfFees, sumOfEndingBalances, sumOfOverdrafts, sumOfCreditCardAdvances and ?**?
    A-1-2-26)     DISPLAY the ?The information in the above report? line with the following arguments: myFile.getCountOfRecords()
    A-1-2-27)     DISPLAY the ?Path to file? line with the following arguments: myFile.getFilePath()
    A-1-2-28)     DISPLAY the ?Name of file? line with the following arguments: myFile.getFileName()
    A-1-2-29)     DISPLAY the ?End of program? line
    This private static method has no return value, and has three parameters: currentAccount of type CheckingAccount, myFile of type MyCsvFile and myFields of type String array.
    A-1-3-01)     CALL method currentAcccount.getBalance and ADD its return value to sumOfBeginningBalances
    A-1-3-02)     CALL method printBeginningBalance with the following argument list: currentAccount
    A-1-3-03)     CALL method myFile.readARecord, which reads the 1st record after the Balance record (a deposit or withdrawal) for the current customer
    A-1-3-04)     CALL method myFile.getCsvRecordFieldArray and ASSIGN its return value to myFields, a String array. This makes the values from the
    A-1-3-05)          fields in the record just read available for access as elements in the myFields string array
    A-1-3-06)     WHILE (myFile.getEofFound() IS FALSE AND currentAccount.getAccountId().equals(myFields[indexForAccountId]))
    A-1-3-07)          IF (myFields[indexForRecordType].equals(recordTypeForDeposit))
    A-1-3-08)               CALL method handleDeposit with the following argument list: currentAccount,
    A-1-3-09)                    Double.parseDouble(myFields[indexForDepositAmount]
    A-1-3-10)          ELSE
    A-1-3-11)               CALL method handleWithdrawal with the following argument list: currentAccount,
    A-1-3-12)                    Double.parseDouble(myFields[indexForWithdrawalAmount]
    A-1-3-13)          END IF
    A-1-3-14)          CALL method myFile.readARecord, which reads the next deposit or withdrawal record, if any, for this customer
    A-1-3-15)     CALL method myFile.getCsvRecordFieldArray and ASSIGN its return value to myFields, a String array. This makes the value from the
    A-1-3-16)          fields in the record just read available for access as elements in the myFields string array
    A-1-3-17)     END WHILE
    A-1-3-18)     CALL method currentAcccount.getBalance and ADD its return value to sumOfEndingBalances
    A-1-3-19)     CALL method printEndingBalance with the following argument list: currentAccount
    This private static method has no return value, and has three parameters: currentAccount of type CheckingAccountPlus, myFile of type MyCsvFile and myFields of type String array.
    A-1-4-01)     CALL method currentAcccount.getBalance and ADD its return value to sumOfBeginningBalances
    A-1-4-02)     CALL method printBeginningBalance with the following argument list: currentAccount
    A-1-4-03)     CALL method myFile.readARecord, which reads the 1st record after the Balance record (a deposit or withdrawal) for the current customer
    A-1-4-04)     CALL method myFile.getCsvRecordFieldArray and ASSIGN its return value to myFields, a String array. This makes the values from the
    A-1-4-05)          fields in the record just read available for access as elements in the myFields string array
    A-1-4-06)     WHILE (myFile.getEofFound() IS FALSE AND currentAccount.getAccountId().equals(myFields[indexForAccountId]))
    A-1-4-07)          IF (myFields[indexForRecordType].equals(recordTypeForDeposit))
    A-1-4-08)               CALL method handleDeposit with the following argument list: currentAccount,
    A-1-4-09)                    Double.parseDouble(myFields[indexForDepositAmount]
    A-1-4-10)          ELSE
    A-1-4-11)               CALL method handleWithdrawal with the following argument list: currentAccount,
    A-1-4-12)                    Double.parseDouble(myFields[indexForWithdrawalAmount]
    A-1-4-13)          END IF
    A-1-4-14)          CALL method myFile.readARecord, which reads the next deposit or withdrawal record, if any, for this customer
    A-1-4-15)     CALL method myFile.getCsvRecordFieldArray and ASSIGN its return value to myFields, a String array. This makes the value from the
    A-1-4-16)          fields in the record just read available for access as elements in the myFields string array
    A-1-4-17)     END WHILE
    A-1-4-18)     CALL method currentAcccount.getBalance and ADD its return value to sumOfEndingBalances
    A-1-4-19)     CALL method printEndingBalance with the following argument list: currentAccount
    This private static method has no return value, and has two parameters: currentAccount of type CheckingAccount and amount of type double.
    A-1-5-01)     ADD amount TO sumOfDeposits
    A-1-5-02)     CALL method currentAccount.makeDeposit, passing it the following arguments: amount
    A-1-5-03)     DISPLAY the deposit line using the following arguments: amount
    This private static method has no return value, and has two parameters: currentAccount of type CheckingAccountPlus and amount of type double.
    A-1-6-01)     ADD amount TO sumOfDeposits
    A-1-6-02)     CALL method currentAccount.makeDeposit, passing it the following arguments: amount
    A-1-6-03)     DISPLAY the deposit line using the following arguments: amount
    This private static method has no return value, and has two parameters: currentAccount of type CheckingAccount and amount of type double.
    A-1-7-01)     IF (currentAccount.makeWithdrawal(amount) IS TRUE)
    A-1-7-02)          ADD amount TO sumOfWithdrawals
    A-1-7-03)          DISPLAY the withdrawal line using the following arguments: amount
    A-1-7-04)     ELSE
    A-1-7-05)          DEFINE variable overdraftFee of type double and ASSIGN it the value returned from a call of method currentAccount.getOvedraftFee
    A-1-7-06)          ADD overdraftFee TO sumOfFees
    A-1-7-07)          ADD amount TO sumOfOverdrafts
    A-1-7-08)          DISPLAY the overdraft line using the following arguments: overdraftFee, amount
    A-1-7-09)     END IF
    This private static method has no return value, and has two parameters: currentAccount of type CheckingAccountPlus and amount of type double.
    A-1-8-01)     IF (currentAccount.makeWithdrawal(amount) IS TRUE)
    A-1-8-02)          ADD amount TO sumOfWithdrawals
    A-1-8-03)          DISPLAY the withdrawal line using the following arguments: amount
    A-1-8-04)     ELSE
    A-1-8-05)          DEFINE variable creditCardAdvance of type double and ASSIGN it the value returned from a call of method
    A-1-8-06)               currentAccount.getCreditCardAdvance
    A-1-8-07)          ADD creditCardAdvance TO sumOfCreditCardAdvances
    A-1-8-08)          ADD currentAccount.getActualWithdrawal() TO sumOfWithdrawals
    A-1-8-09)          DISPLAY the credit-card-advance line using the following arguments: currentAccount.getActualWithdrawal(),creditCardAdvance
    A-1-8-10)     END IF
    This private static method has no return value, and has one parameter: currentAccount of type CheckingAccount.
    A-1-9-01)     DISPLAY the beginning balance line using the following arguments: currentAccount , currentAccount.getAccountId(),
    A-1-9-02)          currentAccount.getAccountType() and currentAccount.getBalance()
    This private static method has no return value, and has one parameter: currentAccount of type CheckingAccountPlus.
    A-1-10-01)     DISPLAY the beginning balance line using the following arguments: currentAccount , currentAccount.getAccountId(),
    A-1-10-02)          currentAccount.getAccountType() and currentAccount.getBalance()
    This private static method has no return value, and has one parameter: currentAccount of type CheckingAccount.
    A-1-11-01)     DISPLAY the ending balance line using the following arguments: ?Account Totals,? currentAccount.getAccountId(),
    A-1-11-02)          currentAccount.getAccountType(), currentAccount.getBeginningBalance(), currentAccount.getDeposits(),
    A-1-11-03)          currentAccount.getWithdrawals(), currentAccount.getFees(), currentAccount.getBalance() and
    A-1-11-04)          currentAccount.getOverdrafts(), ?? *?

    You're calling a bunch of methods and constructors with the wrong arguments, or missing arguments. Take the errors one by one, and look at the method you're being told you're calling, and check that the arguments you're using are right

  • I need help to solve this method

    public interface ObstacleCourseInterface {
      /* THE RECURSIVE-BACKTRACKING method which exhaustively searches
       * the maze for an exit.
       * Returns: TRUE to the caller if at the current level, it found an
       * exit OR false, if it cant go anywhere else from the current position
      public boolean findTheExit(int row, int col);
      /*  Used to determine whether you can move into array[row][col].
       *  It can only move into that cell if it is not a wall and it is
       *  not already in the current path.
       *  Returns true if you can move in, false if you cannot.
      public boolean possible(int row, int col);
      /* Returns the start row for the pacman. Determined
       * by reading in the input file and searching for the 'S'
      /* Return a textual representation of the maze */
      public String toString();
      // Some getter methods needed by the GUI
      public int getStartRow();
      /* Returns the start column for the pacman. Determined
       * by reading in the input file and searching for the 'S'
      public int getStartColumn();
      /* This method returns a reference to the 2D char-array used by YOU
       * to represent the obstacle course(which is constructed from a filename
       * specified during the construction of a new ObstacleCourse object).
       * Returns: Reference to YOUR 2D char-array instance variable
      public char[][] getArray();
    }how do I solve for the possible method??
    so far this is how I have created it:
    public boolean possible(int row, int col) {
              boolean result = false;
              char [][] array = this.getArray();
              if (array[row][col] != '+' && ???? )
                   result = true;
              return result;
         }I don't know how to solve for the current path

    What sort of visa card is it, debit or credit ? If it's a debit card then I don't think that they are still accepted as a valid payment method in all countries - from this page :
    You may be able to use other payment types in your country, like debit and Maestro cards.
    which implies that they are not accepted in all countries, and there have been a number of posts about them being declined.
    You haven't changed the address on your iTunes account (a card needs to be registered to exactly the same name and address, including format and spacing etc, that you have on your iTunes account) and you are still in the country where the card was issued ? You could check with the card issuer to see if it's them that are declining it, and if not then try contacting iTunes support and see if they know why it's being declined : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Account Management

  • Need help in alignment a form

    Hello,
    I am new in writing HTML code. I need help to align my Form
    and it's text.
    Please view my code and please show me how to align all the
    square boxes (the square box is where the user type the text
    input). Currently I have 2 boxes but they are not aligned. The
    below is my code:
    <FORM name="input" method="get" >
    PROJECTROOT: <INPUT TYPE=TEXT SIZE=50 NAME=proj_root>
    <br>
    FRONTEND: <INPUT TYPE=TEXT SIZE=50 NAME=frontend>
    <br>>
    <BR>
    <INPUT TYPE=SUBMIT VALUE=Submit onclick="save()">
    <BR>
    </FORM>
    Would you please help.
    Thank you very much
    Goober35

    <form name="input" method="get" action=""> <!-- ARE
    YOU SURE YOU NEED "GET"
    and not "POST"? -->
    <table cellspacing="0" cellpadding="0" border="0"
    width="300">
    <tr>
    <td><label for="proj_root">PROJECTROOT:
    </label></td>
    <td><input type="text" size="50" name="proj_root"
    id="proj_root"></td>
    </tr>
    <tr>
    <td><label for="frontend">FRONTEND:
    </label></td>
    <td><input type="text" size="50" name="frontend"
    id="frontend"></td>
    </tr>
    <tr>
    <td colspan="2" align="center"><input type="submit"
    name="submit"
    id="submit" value="Submit" onclick="save()"></td>
    </tr>
    </table>
    </form>
    (your form needs an action attribute value)
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "goober35" <[email protected]> wrote in
    message
    news:gcjmlh$p42$[email protected]..
    > Hello,
    > I am new in writing HTML code. I need help to align my
    Form and it's text.
    > Please view my code and please show me how to align all
    the square boxes
    > (the
    > square box is where the user type the text input).
    Currently I have 2
    > boxes but
    > they are not aligned. The below is my code:
    >
    > <FORM name="input" method="get" >
    > PROJECTROOT: <INPUT TYPE=TEXT SIZE=50
    NAME=proj_root> <br>
    > FRONTEND: <INPUT TYPE=TEXT SIZE=50 NAME=frontend>
    <br>>
    > <BR>
    > <INPUT TYPE=SUBMIT VALUE=Submit onclick="save()">
    <BR>
    >
    > </FORM>
    >
    >
    > Would you please help.
    >
    > Thank you very much
    > Goober35
    >
    >
    > <FORM name="input" method="get" >
    > PROJECTROOT: <INPUT TYPE=TEXT SIZE=50
    NAME=proj_root> <br>
    > FRONTEND: <INPUT TYPE=TEXT SIZE=50 NAME=frontend>
    <br>>
    > <BR>
    > <INPUT TYPE=SUBMIT VALUE=Submit onclick="save()">
    <BR>
    >
    > </FORM>
    >

  • Need help to draw a graph from the output I get with my program please

    Hi all,
    I please need help with this program, I need to display the amount of money over the years (which the user has to enter via the textfields supplied)
    on a graph, I'm not sure what to do further with my program, but I have created a test with a System.out.println() method just to see if I get the correct output and it looks fine.
    My question is, how do I get the input that was entered by the user (the initial deposit amount as well as the number of years) and using these to draw up the graph? (I used a button for the user to click after he/she has entered both the deposit and year values to draw the graph but I don't know how to get this to work?)
    Please help me.
    The output that I got looked liked this: (just for a test!) - basically this kind of output must be shown on the graph...
    The initial deposit made was: 200.0
    After year: 1        Amount is:  210.00
    After year: 2        Amount is:  220.50
    After year: 3        Amount is:  231.53
    After year: 4        Amount is:  243.10
    After year: 5        Amount is:  255.26
    After year: 6        Amount is:  268.02
    After year: 7        Amount is:  281.42
    After year: 8        Amount is:  295.49
    After year: 9        Amount is:  310.27
    After year: 10        Amount is:  325.78
    After year: 11        Amount is:  342.07
    After year: 12        Amount is:  359.17
    After year: 13        Amount is:  377.13
    After year: 14        Amount is:  395.99
    After year: 15        Amount is:  415.79
    After year: 16        Amount is:  436.57
    After year: 17        Amount is:  458.40And here is my code that Iv'e done so far:
    import javax.swing.*;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.RenderingHints;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.lang.Math;
    import java.text.DecimalFormat;
    public class CompoundInterestProgram extends JFrame implements ActionListener {
        JLabel amountLabel = new JLabel("Please enter the initial deposit amount:");
        JTextField amountText = new JTextField(5);
        JLabel yearsLabel = new JLabel("Please enter the numbers of years:");
        JTextField yearstext = new JTextField(5);
        JButton drawButton = new JButton("Draw Graph");
        public CompoundInterestProgram() {
            super("Compound Interest Program");
            setSize(500, 500);
            setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            amountText.addActionListener(this);
            yearstext.addActionListener(this);
            JPanel panel = new JPanel();
            panel.setBackground(Color.white);
            panel.add(amountLabel);
            amountLabel.setToolTipText("Range of deposit must be 20 - 200!");
            panel.add(amountText);
            panel.add(yearsLabel);
            yearsLabel.setToolTipText("Range of years must be 1 - 25!");
            panel.add(yearstext);
            panel.add(drawButton);
            add(panel);
            setVisible(true);
            public static void main(String[] args) {
                 DecimalFormat dec2 = new DecimalFormat( "0.00" );
                CompoundInterestProgram cip1 = new CompoundInterestProgram();
                JFrame f = new JFrame();
                f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                f.getContentPane().add(new GraphPanel());
                f.setSize(500, 500);
                f.setLocation(200,200);
                f.setVisible(true);
                Account a = new Account(200);
                System.out.println("The initial deposit made was: " + a.getBalance() + "\n");
                for (int year = 1; year <= 17; year++) {
                      System.out.println("After year: " + year + "   \t" + "Amount is:  " + dec2.format(a.getBalance() + a.calcInterest(year)));
              @Override
              public void actionPerformed(ActionEvent arg0) {
                   // TODO Auto-generated method stub
    class Account {
        double balance = 0;
        double interest = 0.05;
        public Account() {
             balance = 0;
             interest = 0.05;
        public Account(int deposit) {
             balance = deposit;
             interest = 0.05;
        public double calcInterest(int year) {
               return  balance * Math.pow((1 + interest), year) - balance;
        public double getBalance() {
              return balance;
    class GraphPanel extends JPanel {
        public GraphPanel() {
        public void paintComponent(Graphics g) {
            Graphics2D g2 = (Graphics2D)g;
            g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
            g2.setColor(Color.red);
    }Your help would be much appreciated.
    Thanks in advance.

    watertownjordan wrote:
    http://www.jgraph.com/jgraph.html
    The above is also good.Sorry but you need to look a bit more closely at URLs that you cite. What the OP wants is a chart (as in X against Y) not a graph (as in links and nodes) . 'jgraph' deals with links and nodes.
    The best free charting library that I know of is JFreeChart from www.jfree.org.

  • Need help on returning input

    Hi. I'm making a DateTimePicker (DTP), and I need help on getting a method to return a Date only when the DTP is closed, and I want this to be done in the DTP class itself.
    For now, I've used an infinite loop and it seems to work fine without lagging the computer (my computer is above average), but I'm not sure if there's another more efficient way.
    I would prefer not to use threads, but if that's the only option then I suppose it's unavoidable.
    I'm using:
    while(true){
        switch(returnState){
        case UNINITIALIZED: continue;
        case SET: return cal.getTime();
        case CANCELED:
            default:
            return null;
    }Screenshots:
    http://i34.tinypic.com/53rb7n.png
    http://i33.tinypic.com/2nsxct4.png
    Azriel~

    You could put any component in a JOptionPane or a JDialog and then easily query the component for results once it has returned.
    For example:
    QueryComponent.java creates a component that can be placed in a JOptionPane and then queried.
    import java.awt.GridLayout;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JComponent;
    import javax.swing.JTextField;
    * A simple component that has two JTextFields and two
    * corresponding "getter" methods to extract information
    * out of the JTextFields.
    * @author Pete
    public class QueryComponent
      private JPanel mainPanel = new JPanel();
      private JTextField firstNameField = new JTextField(8);
      private JTextField lastNameField = new JTextField(8);
      public QueryComponent()
        mainPanel.setLayout(new GridLayout(2, 2, 5, 5));
        mainPanel.add(new JLabel("First Name: "));
        mainPanel.add(firstNameField);
        mainPanel.add(new JLabel("Last Name: "));
        mainPanel.add(lastNameField);
      public String getFirstName()
        return firstNameField.getText();
      public String getLastName()
        return lastNameField.getText();
      // get the mainPanel to place into a JOptionPane
      public JComponent getComponent()
        return mainPanel;
    }QueryComponentTest.java places the component above into a JOptionPane, shows the pane, and then queries the QueryComponent object for the results.
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JOptionPane;
    import javax.swing.JPanel;
    import javax.swing.JComponent;
    public class QueryComponentTest
      private JPanel mainPanel = new JPanel();
      public QueryComponentTest()
        JButton getNamesBtn = new JButton("Get Names");
        getNamesBtn.addActionListener(new ActionListener()
          public void actionPerformed(ActionEvent e)
            getNamesAction();
        mainPanel.add(getNamesBtn);
      // occurs when button is pressed
      private void getNamesAction()
        // create object to place into JOptionPane
        QueryComponent queryComp = new QueryComponent();
        // show JOptionPane
        int result = JOptionPane.showConfirmDialog(mainPanel,
            queryComp.getComponent(), // place the component into the JOptionPane
            "Get Names",
            JOptionPane.INFORMATION_MESSAGE);
        if (result == JOptionPane.OK_OPTION) // if ok selected
          // query the queryComp for its contents by calling its getters
          System.out.println("First Name: " + queryComp.getFirstName());
          System.out.println("Last Name:  " + queryComp.getLastName());
      public JComponent getComponent()
        return mainPanel;
      private static void createAndShowUI()
        JFrame frame = new JFrame("QueryComponentTest");
        frame.getContentPane().add(new QueryComponentTest().getComponent());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.pack();
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);
      public static void main(String[] args)
        java.awt.EventQueue.invokeLater(new Runnable()
          public void run()
            createAndShowUI();
    }Edited by: Encephalopathic on Sep 29, 2008 8:16 PM

Maybe you are looking for