How do I get the methods to respond to my main program?

I have created 3 classes,where class Kunde is my base class and class PudsPrAreal and PudsPrTid are derived classes from class Kunde.
All my classes went through my compiler without error, but my main program is not able to read the methods from my classes.How do I fix that??
my base class:
navn = nyNavn;
adresse = nyAdresse;
rabat = nyRabat;
public void readInput()
System.out.println("Indtast kundens navn:");
navn = SavitchIn.readLine();
System.out.println("Indtast kundens adresse:");
adresse = SavitchIn.readLine();
System.out.println("Modtager " + navn + " en form for rabat?");
System.out.println("(j/n):");
char answer = SavitchIn.readNonwhiteChar();
if (answer == 'j'||answer == 'J')
System.out.println("Indtast den procentsats som " + navn + " modtager:");
rabat = SavitchIn.readLineDouble();
public void writeOutput()
System.out.println("Navn: " + navn);
System.out.println("Adresse: " + adresse);
if (rabat > 0)
System.out.println("Rabat: " + rabat);
public Kunde()
navn = "no record";
adresse = "no record";
rabat = 0;
public String getNavn()
return navn;
public String getAdresse()
return adresse;
public double getRabat()
return rabat;
derived class # 1:
public class PudsPrAreal extends Kunde
private double areal; //i kvadratmeter
private String kunde;
private String pudsningsdato;
private double kvadratmeterPris;
private double pris;
public PudsPrAreal()
super();
kunde = "no record";
pudsningsdato = "no record";
kvadratmeterPris = 0;
pris = 0;
areal = 0;
public PudsPrAreal(String initialKunde, String initialPudsningsdato, double initialAreal,
String initialNavn, String initialAdresse, double initialRabat)
super(initialNavn, initialAdresse, initialRabat);
set(initialKunde, initialPudsningsdato, initialAreal);
public void set(String nyKunde, String nyPudsningsdato, double nyAreal)
kunde = nyKunde;
pudsningsdato = nyPudsningsdato;
areal = nyAreal;
public void readInputPrAreal()
System.out.println("Indtast datoen hvor vinduespudsningen er blevet foretaget:");
pudsningsdato = SavitchIn.readLine();
System.out.println("Hvor mange kvadratmeter skal der afregnes for:");
areal = SavitchIn.readLineDouble();
public double pris(double areal)
double pris;
double kvadratmeterPris;
if (areal > 100)
kvadratmeterPris = 7.0;
else if (areal >= 500)
kvadratmeterPris = 6.5;
else
kvadratmeterPris = 6.0;
double prisEks = areal * kvadratmeterPris; //pris eksclusiv rabat
pris = prisEks * ((100 - getRabat())/100); //pris inclusiv rabat
return pris;
public void writeOutputPrAreal()
System.out.println("Dato for vinduespudsning: " + pudsningsdato);
System.out.println("Navn: " + getNavn());
System.out.println("Adresse: " + getAdresse());
System.out.println("Prisberegningsgrundlag: pr kvadratmeter");
System.out.println("Antal kvadratmeter: " + areal);
System.out.println("Pris pr kvadratmeter: " + kvadratmeterPris + " kr.");
if (getRabat() > 0)
System.out.println("Rabat: " + getRabat());
System.out.println("Pris for vinduespudsningen: " + pris + "kr.");
else
System.out.println("Pris for vinduespudsningen: " + pris + "kr.");
public String getkunde()
return kunde;
public String getPudsningsdato()
return pudsningsdato;
public double getAreal()
return areal;
derived class # 2:
public class PudsPrTime extends Kunde
private int minuter; //tid for vinduespudsningen angives i minuter
private double tid; //tid for vinduespudsningen i timer
private String kunde;
private String pudsningsdato;
private double pris;
public PudsPrTime(String initialKunde, String initialPudsningsdato, int initialMinuter,
String initialNavn, String initialAdresse, double initialRabat)
super(initialNavn, initialAdresse, initialRabat);
set(initialKunde, initialPudsningsdato, initialMinuter);
public void set(String nyKunde, String nyPudsningsdato, int nyMinuter)
kunde = nyKunde;
pudsningsdato = nyPudsningsdato;
minuter = nyMinuter;
public void readInputPrTime()
System.out.println("Indtast datoen hvor vinduespudsningen er blevet foretaget:");
pudsningsdato = SavitchIn.readLine();
System.out.println("Hvor mange minuter skal der afregnes for:");
minuter = SavitchIn.readLineInt();
public double pris(int minuter)
int kvarter;
int minuterTilOvers;
double pris;
kvarter = minuter / 15;
minuterTilOvers = minuter % 15;
if (minuterTilOvers > 0)
kvarter++;
tid = kvarter * 0.25;
double prisEks = tid * 375; //pris eksclusiv rabat
pris = prisEks * ((100 - getRabat())/100);
return pris;
public void writeOutputPrTime()
System.out.println("Dato for vinduespudsning: " + pudsningsdato);
System.out.println("Navn: " + getNavn());
System.out.println("Adresse: " + getAdresse());
System.out.println("Prisberegningsgrundlag: pr time");
System.out.println("Antal timer: " + tid);
System.out.println("Pris pr time: 375 kr.");
System.out.println("Der afregnes pr p�begyndt 15 minuter.");
if (getRabat() > 0)
System.out.println("Rabat: " + getRabat());
System.out.println("Pris for vinduespudsningen: " + pris + "kr.");
else
System.out.println("Pris for vinduespudsningen: " + pris + "kr.");
public String getKunde()
return kunde;
public String getPudsningsdato()
return pudsningsdato;
public int getMinuter()
return minuter;
my main program:
public class Glasklart
public static void main(String[] args)
Glasklart kunde = new Glasklart();
System.out.println("Indtast datoen for idag:");
String dato = SavitchIn.readLine();
kunde.readInput();
System.out.println("Hvad er prisberegningsgrundlaget?");
System.out.println("Skriv 'k' for pr kvadratmeter eller 't' for pr time:");
char svar = SavitchIn.readNonwhiteChar();
if (svar == 'k'||svar == 'K')
kunde.readInputPrAreal();
System.out.println("Afregningsdato: " + dato);
kunde.writeOutputPrAreal();
else if (svar == 't'||svar == 'T')
kunde.readInputPrTime();
System.out.println("Afregningsdato: " + dato);
kunde.writeOutputPrTime();
else
System.out.println("Forkert svar. Pr�v igen.");
System.out.println("Skriv 'k' for pr kvadratmeter eller 't' for pr time:");
svar = SavitchIn.readNonwhiteChar();
error message for my main program:
"Glasklart.java": Error #: 300 : method readInput() not found in class Glasklart at line 10, column 9
"Glasklart.java": Error #: 300 : method readInputPrAreal() not found in class Glasklart at line 16, column 13
"Glasklart.java": Error #: 300 : method writeOutputPrAreal() not found in class Glasklart at line 18, column 13
"Glasklart.java": Error #: 300 : method readInputPrTime() not found in class Glasklart at line 22, column 13
"Glasklart.java": Error #: 300 : method writeOutputPrTime() not found in class Glasklart at line 24, column 13

The problem is that your main class isn't even trying to read the methods in your other classes. In your main() method in Glasklart.java, you do this:
Glasklart kunde = new Glasklart();
System.out.println("Indtast datoen for idag:");
String dato = SavitchIn.readLine();
kunde.readInput();But you didn't define readInput() in Glasklart, you defined it in your "base class" which you didn't quote enough of us to know the name for sure, but I presume is called Kunde.java.
But I also see that you named the variable "kunde". It looks like maybe you're confusing the names of classes with the names of variables that happen to hold objects instantiated from those classes.
If I define classes:
public class Dog {
public class Cat {
}and later do this:
  Cat dog = new Cat();The methods defined in Dog cannot be invoked from from "dog", because "dog" is really a Cat. Just because you called it "dog", it doesn't necesarily mean it's an instance of Dog.

Similar Messages

  • Junit : How can I get the method name (say testMyAddress) that failed

    My code is below
              TestSuite masterSuite = new TestSuite(testClass);
              TestResult result = new TestResult();
              masterSuite.run(result);
                   Enumeration errors = result.errors();
                   while (errors.hasMoreElements())
                        TestFailure error = (TestFailure)errors.nextElement();
                        Test test = error.failedTest();
    /*will give me the class name but how can I get the method that threw the exception.
    I can get fName (that contains the method name) field to get the method,but being private I cannot hold of the field.
    Wondering if there is any easy way to get the method name that threw exception,without writing unneccessary code
                        Class c1 = test.getClass();
    thx
    m

    getting all methods is no good!
    My test class looks like this
    MyTestClass{
    testGoodData(){
    asserttrue(.....);
    testBadData(){
    asserttrue(.....);
    testNullData(){
    asserttrue(.....);
    someHelperMethod(){
    thx
    m

  • TS3274 My Email is frozen - will not respond when touching the screen. How do I get the email to respond?

    My email screen will not respond to any touch - it's frozen one email. I can't delete it or move to another email.
    How can I get the email to respond?
    jdymon

    Try a Reset [Hold the Home and Sleep/Wake buttons down together for 10 seconds or so (until the Apple logo appears) and then release. When the screen goes blank then power ON again in the normal way.] It is 'appsolutely' safe!

  • How can I get the button to respond on the bottom of my phone?

    How can I get the button to respond on the bottom of my phone?

    I don't understand.   Could you explain a little better. 
    Thanks. 

  • How we can get the output in excel format for Spawned programs?

    My requirement is to get the excel output for some of the programs (like -Adjustment Register, Applied Receipts Register). I am trying to achieve this by BI Publisher. But these programs has "Spawned" executable. And when I am changing the output type as"XML" I am getting below error in output-
    "XML Parsing Error: syntax error"
    Can anyne suggest how we can get an XML output and then excel output for Spawned programs?
    Thanks in advance,

    Hi,
    If I get it right, you want to convert RXi (Reports Exchange) reports such as Adjustment Register & Applied Receipts Register into XML Publisher. Normally, you need to change the "Output Format" of the program called by the "Spawned" program to 'XML' -- not the "Spawned" program itself.
    However, I believe RXi reports does not support XML output (atleast in 11i). It could only work on Text & Html format. Check on the metalink note below:
    432719.1 - RXi-Only Reports Generate XML Format Exception With No Output Setting the Output Format to XML
    Hope this helps.
    regards,..
    Rownald

  • How could I get the used rates of cpu and main memory

    I want to get the used rates of the cpus and the memeoy?How could I do?
    I write the code on linux and got them by read the file /proc/meminfo and /proc/loadavg.
    Is there the similar file under solaris?
    Further more , under the linux os, I could make a system sound with function ioctl,which function could make a warning sound in Solaris?
    Thanks a lot!

    For memory usage call vmstat. Can't help with CPU usage.

  • I am working on a windows based program thru Chrome on my Mac. It asked me to cont/alt/delete - how do I get the Mac to respond?

    I am working on a windows based program thru chrome on my mac - how do I control/alt/delete on the mac?

    Control key - Alt (also known as the Option key) and Delete key. However remember Chrome is not an Apple product so if that doesn't work you also might want to seek help on a Google forum that supports Chrome.

  • How can I get the responsibility for concurrent programs

    Guys,
    How can I get the responsibility for a list of concurrent programs. Is there a query that I can run to get the results?
    Thanks in advance,

    Refer to Note: 134036.1 - WHOCANRUN.SQL - List Responsibilities That Can Run a Given Concurrent Program
    https://metalink.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=134036.1
    From the output of the query in the note referenced above, you can run "Users of a Responsibility" concurrent program then to find out the list of users who have access to a certain responsibility.

  • How can I get the variable with the value from Thread Run method?

    We want to access a variable from the run method of a Thread externally in a class or in a method. Even though I make the variable as public /public static, I could get the value till the end of the run method only. After that scope of the variable gets lost resulting to null value in the called method/class..
    How can I get the variable with the value?
    This is sample code:
    public class SampleSynchronisation
         public static void main(String df[])
    sampleThread sathr= new sampleThread();
    sathr.start();
    System.out.println("This is the value from the run method "+sathr.x);
    // I should get Inside the run method::: But I get only Inside
    class sampleThread extends Thread
         public String x="Inside";
         public void run()
              x+="the run method";
    NB: if i write the variable in to a file I am able to read it from external method. This I dont want to do

    We want to access a variable from the run method of a
    Thread externally in a class or in a method. I presume you mean a member variable of the thread class and not a local variable inside the run() method.
    Even
    though I make the variable as public /public static, I
    could get the value till the end of the run method
    only. After that scope of the variable gets lost
    resulting to null value in the called method/class..
    I find it easier to implement the Runnable interface rather than extending a thread. This allows your class to extend another class (ie if you extend thread you can't extend something else, but if you implement Runnable you have the ability to inherit from something). Here's how I would write it:
    public class SampleSynchronisation
      public static void main(String[] args)
        SampleSynchronisation app = new SampleSynchronisation();
      public SampleSynchronisation()
        MyRunnable runner = new MyRunnable();
        new Thread(runner).start();
        // yield this thread so other thread gets a chance to start
        Thread.yield();
        System.out.println("runner's X = " + runner.getX());
      class MyRunnable implements Runnable
        String X = null;
        // this method called from the controlling thread
        public synchronized String getX()
          return X;
        public void run()
          System.out.println("Inside MyRunnable");
          X = "MyRunnable's data";
      } // end class MyRunnable
    } // end class SampleSynchronisation>
    public class SampleSynchronisation
    public static void main(String df[])
    sampleThread sathr= new sampleThread();
    sathr.start();
    System.out.println("This is the value from the run
    method "+sathr.x);
    // I should get Inside the run method::: But I get
    only Inside
    class sampleThread extends Thread
    public String x="Inside";
    public void run()
    x+="the run method";
    NB: if i write the variable in to a file I am able to
    read it from external method. This I dont want to do

  • How can I get the variable with the value from Thread's run method

    We want to access a variable from the run method of a Thread externally in a class or in a method. Even though I make the variable as public /public static, I could get the value till the end of the run method only. After that scope of the variable gets lost resulting to null value in the called method/class..
    How can I get the variable with the value?
    This is sample code:
    public class SampleSynchronisation
         public static void main(String df[])
    sampleThread sathr= new sampleThread();
    sathr.start();
    System.out.println("This is the value from the run method "+sathr.x);
    /* I should get:
    Inside the run method
    But I get only:
    Inside*/
    class sampleThread extends Thread
         public String x="Inside";
         public void run()
              x+="the run method";
    NB: if i write the variable in to a file I am able to read it from external method. This I dont want to do

    Your main thread continues to run after the sathr thread is completed, consequently the output is done before the sathr thread has modified the string. You need to make the main thread pause, this will allow sathr time to run to the point where it will modify the string and then you can print it out. Another way would be to lock the object using a synchronized block to stop the main thread accessing the string until the sathr has finished with it.

  • How can I get the query name in webitem method ?

    Hello,
    I have defined a new web item but I can't retrieved parameter of my webitem in the RENDER method for instance. I have declared a parameter in the RSRRENDERATR table like this :
    REN_NAME : MY_WEBITEM
    ATR_NAME : MY_PARAM
    ATR TYP : TEXT
    CHR MAX LEN : 50
    How can I do this ? How can I get the MY_PARAM value in the RENDER method ?
    Thanks a lot
    GC.
    Edited by: CoGr on Feb 11, 2008 12:10 PM

    Hi ,
    data l_r_view type ref cl_rsr_www_view.
    data l_t_text_symbols type rrx1_t_txt_symbols.
    l_r_view =? n_r_data_provider.
    CALL METHOD L_R_VIEW->n_r_request->TEXT_ELEMENTS_GET
      IMPORTING
        E_T_TXT_ELEMENTS = l_t_text_symbols.
    l_t_text_symbols contains all DP information like Query technical name, or Report text last load etc.
    best regards,
    kai

  • How can I get the InsertionPoint with FindText method.

    Hi All:
    In indesing script, I can find "abc text" with FindText method, and I want to insert a image here, but how can I get the insertionPoint(the FindText method return an object)? any help?
    Thanks in advance.

    What seems to be the problem?
    >app.findTextPreferences.findWhat = "text";
    >text = app.activeDocument.findText();
    >alert ("insertionpt "+text[0].insertionPoints[0].horizontalOffset);
    gives (as expected) the horizontal position of the first occurrance of "the".
    Note that findText returns an
    i array
    of found items; its length may be 0 (not found), 1 (only found once), or any other number.
    InsertionPoints is
    i also
    an array. Perhaps you expected it to be 'the' position of the found text -- it doesn't. It's an array of all insertion points in the found text.
    'The' position of the text (in its parent text) is something like text[0].index ("The index of the Text in the collection or parent object.")

  • HT1918 The option to not have a payment method does not show up in my menu it is only giving me credit card options..how do I get the no payment option back

    How do I get the option back to not have a payment method

    Same for me...that option seems to have gone away and I cannot figure out how to get more emails to show up.
    Killin me!!

  • Sorting in iTunes changed - How do I get the former method restored?

    For a couple years I used iTunes for Windows with 2 music content folders - the normal iTunes folder(s) under my Windows profile in which I kept iTunes-purchases and iTunes CD-ripped songs, and one in c:\mp3 for unprotected ripped or purchased MP3 files. Until I made a change in iTunes, I had the following sort order properties when the corresponding header bar was clicked:
    Title
    =======
    'Wonderful
    "Dalla...
    "In Crowd...
    (I Love you) For...
    1,2,3
    101 Eastbound
    A Beautiful Morning
    Your Wildest Dreams.
    The same sort of effect was seen when sorting by Artist or Album or whatever.
    I decided I wanted ONE music folder. On advice from a magazine (Maximum PC) column, in preferences I chose to have iTunes organize my music (previously unchecked) and then in the advanced tab chose to iTunes Consolidate my music. It copied my music and everything initially looked fine. But, after looking more carefully, I saw the following new effect:
    Title
    =========
    Abilene
    Your Wildest Dreams
    1,2,3
    101 Eastbound
    99 Miles from L.A.
    and,
    Artist
    ======
    a-ha
    A3
    ZZ-Top
    10cc
    5th Dimension
    It's as if the entire sort order algorthm is different as regards punctuation and numerals. So, I unchecked the option to have iTunes "organize" my music, but the order didn't change.
    What am I missing here?? How do I get the former order back to column sorting?
    I'd appreciate any help you could give me - this is pretty annoying.
    thanks.
    Windows XP SP2
    Intel 2Mhz Core 2 Duo
    100MB H/D, 2GB RAM
    iTunes 7.3.0.54

    Get info and change the sort field(s) for one song,
    then click Apply.
    Right click the song and select Apply sort field and
    pick which you want.
    Unfortunately this is not working as intended with iTunes 7.3 for Windows (Mac too?). The "Apply Sort Field ..." does apply the new Sort Artist, Sort Album, etc. to related songs, but iTunes refuses to recognize that the songs were updated. If you check the tags, sure enough their Sort Artist, etc. have been updated, but iTunes does not seem to make use of the change. The only way I've been able to make it work is to go back into Get Info for each song and just cycle through them one-by-one without changing anything. As you cycle through, then the songs move to their proper sort order based on the updated sorting option. This wasn't the case with 7.2, so this would be a new bug.

  • How can we get the values from the view?

    Hi All,
    my scenario is i have two fields in my view .one is parameter.and another on is select-options.how can i get the user entered values into my selection screen.?
    for the select options i get the values into field-symbol.for parameter i get the value using get_attribute.
    can i use like this in select statement.
    WHERE SERVICE_ID  = ZSD_DD_AUFNRS
                       AND CRE_DT IN <FS_DATE>.
    Regards,
    Ravi.

    Hi Sravan,
    when i am using the below code to generate self defined functions i m getting a error .
    *Generate an object for self defined functions
      DATA: lo_self_functions TYPE REF TO if_salv_wd_function_settings,
    *Generate an object for button 'Confirm'
           lr_button TYPE REF TO cl_salv_wd_fe_button,
           lo_self_function TYPE REF TO cl_salv_wd_function,
                  l_text type string.
    *Set Self-defined functions
    *'Confirm' Button
      lo_self_functions ?= l_value..
      lo_self_function = lo_self_functions->create_function( 'CONFIRM'  ).
      CREATE OBJECT lr_button.
      CLEAR l_text.
      l_text = 'Confirm'.
      lr_button->set_text( l_text ).
      lr_button->set_image_source( '' ).
      lr_button->set_image_first( 'X' ).
      lo_self_function->set_editor( lr_button ).
    Error when processing your request
    What has happened?
    The URL http://cgslsvr3.cgsl.com:8020/sap/bc/webdynpro/sap/zsdr_cash_work_list/ was not called due to an error.
    Note
    The following error text was processed in the system CGD : WebDynpro Exception: IDs Can Only Contain Characters of Syntactical Character Set
    The error occurred on the application server cgslsvr3_CGD_20 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
    Method: RAISE of program CX_WD_GENERAL=================CP
    Method: CONSTRUCTOR of program CL_WDR_VIEW_ELEMENT===========CP
    Method: CONSTRUCTOR of program CL_WD_TOOLBAR_BUTTON==========CP
    Method: NEW_TOOLBAR_BUTTON of program CL_WD_TOOLBAR_BUTTON==========CP
    Method: IF_SALV_WD_COMP_TABLE_UI~CREATE_TOOLBAR_ITEM of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~CREATE_TOOLBAR_ITEMS of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~UPDATE_TOOLBAR_ITEMS of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~UPDATE_TOOLBAR of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_COMP_TABLE_UI~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
    What can I do?
    If the termination type was RABAX_STATE, then you can find more information on the cause of the termination in the system CGD in transaction ST22.
    If the termination type was ABORT_MESSAGE_STATE, then you can find more information on the cause of the termination on the application server cgslsvr3_CGD_20 in transaction SM21.
    If the termination type was ERROR_MESSAGE_STATE, then you can search for more information in the trace file for the work process 0 in transaction ST11 on the application server cgslsvr3_CGD_20 . In some situations, you may also need to analyze the trace files of other work processes.
    If you do not yet have a user ID, contact your system administrator.
    Error code: ICF-IE-http -c: 110 -u: CT-0024 -l: E -s: CGD -i: cgslsvr3_CGD_20 -w: 0 -d: 20080414 -t: 105835 -v: RABAX_STATE -e: UNCAUGHT_EXCEPTION
    HTTP 500 - Internal Server Error
    Your SAP Internet Communication Framework Team
    How can i resolve it?
    Regards,
    Ravi

Maybe you are looking for

  • Can't back up using time machine...

    I am trying to back up my MBP (2010) running lion. Everytime i have tried to back it up over the last couple of weeks, i have returned to this message (shown below), and occasionallly a message telling me that my external drive (Western Digital 2TB)

  • How to move .plist files from /Library/Preferences

    Hi, We are trialing using software called Deep Freeze to take a snap shot of the OS that is restored upon reboot thus removing the majority of configuration changes and thus reducing the amount of support calls. When setting up the software you have

  • Itunes not working properly

    I need help, every time i play videos there's an error message sayings itunes not working properly even though i already updated it to newest versions?

  • SQL statement Advice Please

    Hi - Nice to see the forums back :-) Ok i have quite a complex question here, but hope some clever peep can help me out. I have a search page with four methods of searching the database. The code used on the results page is below. I've created a thre

  • All rows in table do not qualify for specified partition

    SQL> Alter Table ABC 2 Exchange Partition P1 With Table XYZ; Table altered. SQL> Alter Table ABC 2 Exchange Partition P2 With Table XYZ; Exchange Partition P2 With Table XYZ ERROR at line 2: ORA-14099: all rows in table do not qualify for specified p