Methods... What to do...?

1. 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.
What a beautiful question... And i have answered most of it...
I just need a help with explaining the delimeters... Your answer will be fully referenced in my assignment, I only need to know what delimeters are... can anybody help?
Thanks...

"... its begin/end delimiters and the method call itself:"
As well as defining a
doThis(){
BLOCK
OF
CODE
the delimiters also perform the function of a flow of execution
eg;-
<A Program for a user data form>
1. Declare variables that need access all functions such as Strings, ints, buttons and textfields
2. {
[CodeBlock1]
initialise active variables and set up GUI with the methods init() =java.awt or javax.swing [CodeBlock1]
and paint() (
[CodeBlock2]=java.awt.Graphics etc [CodeBlock2]
3. function waits for a call
public void checkdata(){
CHECK
DATA
CODE
if (!(correct)) tellClientWhatsWrong()
else processData()
public void tellClientWhatsWrong(){
CODE
public void processData(){
PutItAll
TogetherCode
nowThatItsready
SaveData()
public void SaveData(){
CODE to save data to file
Each block of code defines clearly its own method() -(as indicated by the parenthisis() )
This makes it easier to read /understand / amend or correct -BUT ALSO there is a logical flow to the program, in this a example a user form, so all of the methods don't do anything until the user does something
So we also have a function called
actionPerformed(){
if(condition=user hits the 'send' button){
checkdata()
So it goes along the daisy chain of functions above from the checkData() method to the processData() method and then to the saveData() method
= LOGICAL PROGRAMMING STRUCTURES!

Similar Messages

  • HT2731 i used debit card for purchasing i dont have credit card now its showing your payment method is decline use another payment method what shoul i do i dont have credit card

    i used debit card for purchasing i dont have credit card now its showing your payment method is decline use another payment method what should i do i dont have credit card or any another account

    I don't think that debit cards are still accepted as a valid payment method - they are not listed on this page and there have been a number of posts recently about them being declined. You could try contacting iTunes support and see if they can help, but I don't think you will be able to use a debit card : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page
    Are iTunes gift cards available in your country ? They are not available in all, and they are country-specific (they can only be used in their country of issue), but if there you could possibly use them as your payment method.

  • HT201209 i cant register my debit card to apple id...........when i am tring to register........it shows your payment method was delclined please  enter a valid payment method what should i do???

    i cant register my debit card to apple id...........when i am tring to register........it shows your payment method was delclined please  enter a valid payment method what should i do???

    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.
    Is the card then is it registered to exactly the same name and address (including format and spacing etc) that you have on your iTunes account, it was issued by a bank in your country and you are currently in that country ? If it is then 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.
    Or do you have a credit card that you could use instead ?

  • I Try registering my card in order to use the services of Itunes so that always appears refused payment method, what should I do?

    I Try registering my card in order to use the services of Itunes so that always appears refused payment method, what should I do?

    If you are referring to a credit card and it being refused, then something is probably wrong with the entry of the card or your account information. It is not matching what is on file for your account. Generally this is the address field. Make sure it matches what you see on your bill exactly. Otherwise, you need tocontact iTunes support. http://www.apple.com/emea/support/itunes/contact.html

  • Java Virtual Machine "Could not find main method"  what do i do?

    Hi I'm very new to java and for my class we are to make an applet and make a class. I figured out how to do it but the Java Virtual Machine gives me an error when I go to run the applet."Could not find the main method. Program Will exit!" . I am using Jbuilder8 personal to compile the code. Using j2sdk1.4.0_03. Could someone tell me how to fix this? Or what I'm doing wrong?
    Here is my code.
    package assignment5;
      Program: Program 5.2
      Author: Will W.
      Date: 02/20/03
      Description: Create a student class that holds the
      student name, student ID, phone and number of units
      completed. Create methods and a applet to input data
      Dispay the student name, student ID, phone, units
      completed in a text area.
    import java.applet.*;
    import java.awt.event.*;
    import java.awt.*;
    public class Assignment5Applet extends Applet implements ActionListener
         //Create Components
         //TextFields
         TextField txtName = new TextField(25);
         TextField txtId  = new TextField(15);
         TextField txtPhone = new TextField(15);
         TextField txtUnits = new TextField(4);
         //TextArea
         TextArea txaList = new TextArea(20,40);
         //Button
         Button btnAdd = new Button("Go");
         //Labels mostly debugging purposes.
         Label lblOutput = new Label();
         Label lblNumberProcessed = new Label();
         Label lblError = new Label();
         public void init()
              //Create the interface for the applet
              Panel pnlLayout = new Panel(new GridLayout(5, 2));
              pnlLayout.add(new Label("Name:"));
              pnlLayout.add(txtName);
              pnlLayout.add(new Label("Student Id:"));
              pnlLayout.add(txtId);
              pnlLayout.add(new Label("Phone #:"));
              pnlLayout.add(txtPhone);
              pnlLayout.add(new Label("Num Units:"));
              pnlLayout.add(txtUnits);
              add(pnlLayout);
              add(btnAdd);
              add(txaList);
              txtName.requestFocus();
              btnAdd.addActionListener(this);
              txtName.addActionListener(this);
              txtId.addActionListener(this);
              txtPhone.addActionListener(this);
              txtUnits.addActionListener(this);
         public void actionPerformed(ActionEvent evt)
                    //Variables to hold the data in the textboxes
              String strName;
              String strId;
              String strPhone;
              String strUnits;
              try
                   //Get the data
                   strName = txtName.getText();
                   strId = txtId.getText();
                   strPhone = txtPhone.getText();
                   strUnits = txtUnits.getText();
                            //Instantiate a student object
                            Student aStudent = new Student(strName, strId, strPhone, strUnits);
                            //Use get student to get the output
                         txaList.append("Output:" + aStudent.getStudent());
                   lblOutput.setText("");
              catch(NumberFormatException e)
                   lblOutput.setText("Error");
    }The my student class
    package assignment5;
      * Program: Student.java
      * Author: Will W.
      * Date: 02/20/03
      * Descrip:
      * Student Class for Assignment5Applet.java
      * Contains one constructor and 5 other methods
      * for the class
    public class Student
            //Class Variables
            private String  strName;
            private String strId;
            private String strPhone;
            private String strUnits;
            private String strOutput;
            //Constructor
            public Student(String strNewName, String strNewId, String strNewPhone, String strNewUnits)
              setName(strNewName);
              setId(strNewId);
              setPhone(strNewPhone);
              setUnits(strNewUnits);
            //Methods
            public void setName(String strNewName)
                    //Assign new value to private variable
                    strName = strNewName;
            public void setId(String strNewId)
                    strId = strNewId;
            public void setPhone(String strNewPhone)
                    strPhone = strNewPhone;
            public void setUnits(String strNewUnits)
                    strUnits = strNewUnits;
            public String getStudent()
                    //Put the output together
                    strOutput = strName + "\n" + strId + "\n" + strPhone + "\n" + strUnits;
                    return strOutput;
    }Everythings seems to compile correctly without errors it's just when I execute to the running program that the Java Virtual Machine throws me that error saying it can't find the main method.

    Java Virtual Machine "Could not find main method" what do i do?
    Ok Ok OK I got the solution for you ,this is what you do you put your hands inbetweenj you leggs and run around in a circle can scream me nuts me nuts me nuts are on fire,then come back and tell use if the problem is solved or not
    Good luck hehehehe:P

  • Why is my payment method for itunes always declined? i used many mastercards but still it declines my payment method, what should I do?

    apple is not accepting my payment method ,I also used many mastercards but it is always declining it is very annoying what should I do?

    The quickest way to get an answer to this may be to contact your card issuer directly, it may be that they are having issues with their payment gateways.  Also a good idea to do what Ralph9430 suggested as well though.
    Regards,
    Steve

  • Static methods, what for?

    What are static methods for? is there something that is not possible through methods associated with instances (non-static methods) ?

    There are many examples of static mehods in the Java API. For example the Math or the System class. All methods in this classes are static. So you dont have to instantiate the system class. In fact it is even not possible to instantiate the System class. System is final and all Constructors are private.
    Another use for static methods is the access to private static variables.

  • Calling method what is the proper way

    hi fellows
    i want to call a method but i need some help on that issu with or without instance of an object. like
    package ch.fhnw.athene.ui.components;
    import ch.fhnw.athene.ui.components.model.CPTabModel;
    import ch.fhnw.athene.ui.components.model.CPTabpaneModel;
    import ch.fhnw.athene.ui.components.model.CPToolbarModel;
    i have add frame in CPTabmodel.
    i add JButton in CPToolbarModel and actionlistener also.
    the method
    public void showframe(){/body of the method}
    in CPTabpaneModel.
    how can i call this when press button. or define the method static if i define static what happen with frame and button class these are also static or not.

    I would think that using....
    var theMask:MovieClip = myContainer.getChildByName("NAME-"+String(num));
    would work, where you could use theMask to target it.  Another approach to this would be to store each mask in an array so that you can just use the array to target them...
    var maskArray:Array = new Array();
    var myMask:MovieClip = new MovieClip();
    maskArray[i] = myMask;
    myContainer.addChild(myMask);
    myContainer.mask = myMask;
    Note: When you first name the object you should be converting i to a String as well... myMask.name = "NAME-"+String(i);  unless i is already a String

  • Push Instance method : what to pass in TASK and Sync_mode

    Hi All,
             I have created a Push Instace method for a Backend Triggered DO. Now i want to know that what is to be passed in its import parameter Task and Sync_mode.
    There are no possible values defined
    Thanks & Regards,
    Abhishek

    Hi Abhishek,
    Adding to the above reply,
    Task is an optional parameter. If you do not specify a Task, the DOE will dynamically decided what to do with the data. If there is already data for the same key in the CDS it will update it. If there is no data for the same key, it will insert it.
    Incase you want to delete the record, then you will have to specify the task as 'D' explicitly in the importing parameter otherwise its not needed.
    Also,if you do not set the SYNC_MODE, the function module will be executed in queue and the name of the queue will end with '*CMP'. This is just for tracking purpose.
    Best regards,
    Vinodh.

  • FIFO costing method - what table ?

    Hi all,
    I got one child org. which is on FIFO costing method and I got the standard report from Oracle which show the total value of the item.
    Now, I'm intend to write a report to show the details on what value the system will picked up individually when there is a move order/ issue that happened. What are the tables that involved when there is a move order/ issue for the item. I can see
    mtl_cst_actual_cost_details which has new_cost, prior_cost & actual_cost. But when come to move order/issue the actual_cost was average up. I can't see the FIFO picking up ?
    Please advise.
    rgds
    Lim

    Please post this in the Order Management forum also if you havent done so already.

  • I created a new apple id and as my billing info i put in my itunes card. i still have $18 left in the account but it wont let me buy anything because i put none as my payment method. what can i do to fix this?

    i created a new apple id and as my billing info i put in my itunes card number. i still have $18 dollars left in the account but it wont let me buy anything else because it constantly asks for my billing info and i now put none as my payment method. how can i buy stuff again?

    Creating an iTunes Store, App Store, iBookstore, and Mac App Store account without a credit card
    Step 3 is important, no matter whether you do this on a Mac or an iPad / iPhone:
    Important: Before proceeding to the next step, you must download and install a free application. ...
    Important: Before proceeding to the next step, you must download and install the free application by tapping Free followed by tapping Install App. ...

  • Protected methods, what did i do wrong?

    Hi there, I'm trying to understand why I cant access a Protected Method from a library that I'm trying to use..
    Some guidance would be great:
    public class Registration {
    //Create new instance of ConnectionBean
    ConnectionBean conBean = new ConnectionBean();
    public Registration() {
    public void regUser() {
    String server = JOptionPane.showInputDialog( "Enter Server address" );
    InetAddress inetaddress;
    try {
    conBean.connect( inetaddress = InetAddress.getByName( server ));
    catch( UnknownHostException unknownhostexception ) {
    Object aobj[] = {
    "Cancel", "OK"
    int i = JOptionPane.showOptionDialog(null, "Retry Server?", server +
    ": Not Responding", -1, 2, null, aobj, aobj[1]);
    if( i == 1 )
    regUser();
    System.out.println( "Cannot resolve " + server + ":" + unknownhostexception.toString ());
    return;
    catch( IOException ioexception ) {
    Object aobj1[] = {
    "Cancel", "OK"
    int j = JOptionPane.showOptionDialog( null, "Cannot Connect to:",
    server,-1, 2, null, aobj1, aobj1[1] );
    if( j == 1 )
    regUser();
    System.out.println( "Cannot connect " + server);
    return;
    System.out.println( "Registering User" );
    registrationProcess();
    public void registrationProcess () {
    InfoQueryBuilder iqb = new InfoQueryBuilder();
    InfoQuery iq;
    IQRegisterBuilder iqRegb = new IQRegisterBuilder();
    IQRegister iqReg = new IQRegister( iqRegb );
    try {
    //Need to getXMLNS packet method getXMLNS() is protected
    iqReg.getXMLNS();
    catch ( InstantiationException e ) {
    System.out.println( "Error in building Registration packet" );
    String username = JOptionPane.showInputDialog( "Enter: Username" );
    String password = JOptionPane.showInputDialog( "Enter: Password" );
    The error as would be expected:
    Registration.java:96: getXMLNS() has protected access in org.jabber.jabberbeans.Extension.IQRegister
    iqReg.getXMLNS();
    ^
    1 error
    Appreciate the help!! :)

    I tried to extend the class to make it a subclass of IQRegister (which holds the protected method) but I'm getting this error:
    Reg.java:19: cannot resolve symbol
    symbol : constructor IQRegister ()
    location: class org.jabber.jabberbeans.Extension.IQRegister
    public class Reg extends IQRegister {
    ^
    1 error
    Any ideas?
    thanks

  • HT2534 I don't have the option of "none" on the seletion for pament methods, what do i do?

    I have an iPhone 3G, it is 4.2.1 firmware and i can't select the "none" for pament selection in my apple ID settings. Please help me.

    You need to ask Apple to reset your security questions; this can be done by clicking here and picking a method, or if your country isn't listed, filling out and submitting this form.
    They wouldn't be security questions if they could be bypassed without Apple verifying your identity.
    (110798)

  • When I want to download an app it keeps saying payment type is not valid please enter new payment method, what do I do

    When an app is free and it asks for account information which is correct why does it keep saying payment type invalid please choose another payment type.?

    Maybe check with your bank and see if everything is ok with your account.
    settings - appstore - view id - account info, then you can edit your payment.

  • TS1363 My iPod 4G iOS 5.1.1 cannot appears in iTunes, whereas, i have to tried various method. what should i do?

    please help me to solve my problem...

    Read the article from which you posted your question and follow all the troubleshooting steps it lists.

  • What am I doing wrong with this method?

    Ok I tried this for two hours and for some reason my variables from one method wont work with the other method what am I doing wrong?
    public class Testing
    private static void storage(String[] storage){
    String retval= "";
    for(int i=0;i!=storage.length;i++){
    String getstorage= storage[i]+retval;
    return storage[i]+retval;
    }//for
    }//storage
    public static int[] find(String[] str){
    for(int i=0;i!=str.length;i++){
    if(str.equals (storage[i].substring(0,2))){
    return indexOf(str[i], str[i].length);
    else If(str[i].substring(indexOf(str[i]),str[i].length)>storage.substring(indexOf(storage[i]),storage[i].length)){
    return {0,0};
    };//elseif
    }//if
    }//for
    }//find
    }//StrStore

    Thanks got that part fixed and I even kinda learned how to make it so that I can establish the variable somewhere else lemme show you:
    public class StrStore
       private static String[] storage(String[] storage){
                for (int i=0; i!=storage.length; i++);
                  String retval="";
                  return storage[i] +retval;
               }//for
             }//storage
       public static String[] getStorageArray()
         String[] temp= new String[storage.length];
         for (int i=0; i!=storage.length; i++){
                  temp= storage[i];
    return temp;
    }//for
    }//getStorageArray
    public static int[] find(String[] str){
    for(int i=0;i!=str.length;i++){
    if(str[i].equals (storage[i].substring(0,2))){
    return {indexOf(str[i], str[i].length};
    else if(str[i].substring(indexOf(str[i]),str[i].length>storage.substring(indexOf(storage[i]),storage[i].length)){
    return {0,0};
    }//elseif
    }//if
    }//for
    }//find
    public static int[] encode(String str){
    for(int i=0;i!=str.length;i++){
    if(str[i].length>storage[i].length);
    return str[i]+storage[i];
    else{
    find(storage[i]);
    }//elseif
    }//if
    }//for
    }//encode
    public static Int[] decode(int[] code){
    for(int i=0;i!=str.length;i++){
    return find(storage[i]);
    }//for
    }//decode
    public static void main(String[] args)
    int[][] codes = new int[args.length][];
    for(int i=0;i!=args.length;i++){
    codes[i]=encode(args[i]);
    }//for
    storage(getstorage);
    System.out.println("storage = "+ getStorage);
    for(int i=0;i!=args.length;i++){
    System.out.println(decode(codes[i]));
    }//for
    }//main()
    }//StrStore
    however Im still coming up with 5 errors now one is stating that in this section:
    public static String[] getStorageArray()
         String[] temp= new String[storage.length];
         for (int i=0; i!=storage.length; i++){
                  temp= storage[i];
    return temp;
    }//for
    }//getStorageArray
    that a class is expected but I thought I had the class defined? I get that also here:
       public static int encode(String str){
               for(int i=0;i!=str.length;i++){
                 if(str.length>storage[i].length);
    return str[i]+storage[i];
    else{
    find(storage[i]);
    }//elseif
    }//if
    }//for
    }//encode
    but instead of the beginning I get it at the very last line of that snippet
    then I get that these two variables are incompatible
    private static String[] storage(String[] storage){
                for (int i=0; i!=storage.length; i++);
                  String retval="";
                  return storage[i] +retval;
               }//for
             }//storage

Maybe you are looking for

  • Had a problem copying files, now MBP won't mount the external HD`

    Hi I thought to put this in the MBP forum but since I thik it may be the OS I decided to post here. I have a newer MBP with OS 10.5, I have an external LaCie c0nnected via eSata to keep my firewire 400 port free. I mounted another external HD to the

  • Tiles and RichFaces ?? Calendar

    Do tiles and RichFaces can work together ? I have project, jsf 1.2, tiles, mvc spring, tomcat 6 and i'm trying to add richfaces calendar when I write <rich:calendar/> the calendar button shows but when I click nothing happens. When I write <rich:cale

  • What is this dongle for?

    I got a Mac Pro a few months ago, and it came with this seemingly useless DVI dongle. If you didn't get one too, it is basically a 3" cable that goes from male to female (essentially making a useless 3" extension cable). I can find no purpose for thi

  • How to convert CLOB to BLOB with SQL Developer migration wizard?

    Hi, According to our requirement, we need to only migrate data from SQL Server 2008 to Oracle 11. I use the SQL Developer 3.0.04 migration wizard to do it. I do migration from SQL Server (database name: SCDS41P2) to Oracle (User name: HCDS41P2). My m

  • Legal and management consolidation

    Hi experts, Anybody can specify what are all the differences between legal and management consolidation? What are the tasks that differentiate each one from the other? Regards.