What is the call to this method

I have a method that calculates the difference between two dates; todays date and a returndate for Library-books. I have a instance-method with the get-method mentioned below. But I can't figure out what call I must use so the program runs properly. Any hints ?
See code below.
import java.io.*;
import java.util.*;
import java.text.*;
public class DateGet{
public static void main(String[] args) throws IOException, ParseException{
System.out.print(LabMetoder.numberOfDays(days));
//This call is wrong, what should I write ?
}// end main
public static int numberOfDays (int days) {  
String aLine, returnDate;
Date today = new Date(); // gets todays date
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Book checkDate;
Scanner fin = new Scanner (new FileReader("book.txt")); //open infile
while (fin.hasNext()) {
aLine=fin.nextLine();//reads first line
checkDate = new Book (aLine);//creates object
if (checkDate.getReturnDate()!=null) { // checks that returnDate-field
// isn't empty
String oldDay = (checkDate.getReturnDate());
Date oldDayD = dateFormat.parse(oldDay); //changes oldDay to a
//Dateobject
days = (int)( (today.getTime() - oldDayD.getTime())/
(1000*60*60*24));
//Calculates the difference between todays date and returnDate System.out.println(days);//writes dateobject on screen (this is
          // a check)
} //end if
}// end while
fin.close(); //closes book.txt
return days;
}//end NumberOfDays

I have a method that calculates the difference
between two dates; todays date and a returndate for
Library-books. I have a instance-method with the
get-method mentioned below. But I can't figure out
what call I must use so the program runs properly.
Any hints ?
See code below.
import java.io.*;
import java.util.*;
import java.text.*;
public class DateGet{
public static void main(String[] args) throws
IOException, ParseException{
System.out.print(LabMetoder.numberOfDays(days));
//This call is wrong, what should I write ?
}// end main
public static int numberOfDays (int days) {  
String aLine, returnDate;
Date today = new Date(); // gets todays date
SimpleDateFormat dateFormat = new
SimpleDateFormat("yyyyMMdd");
Book checkDate;
Scanner fin = new Scanner (new
FileReader("book.txt")); //open infile
while (fin.hasNext()) {
aLine=fin.nextLine();//reads first line
checkDate = new Book (aLine);//creates object
if (checkDate.getReturnDate()!=null) { // checks that
returnDate-field
// isn't empty
String oldDay = (checkDate.getReturnDate());
Date oldDayD = dateFormat.parse(oldDay); //changes
oldDay to a
//Dateobject
days = (int)( (today.getTime() - oldDayD.getTime())/
(1000*60*60*24));
//Calculates the difference between todays date and
returnDate System.out.println(days);//writes
dateobject on screen (this is
          // a check)
} //end if
}// end while
fin.close(); //closes book.txt
return days;
}//end NumberOfDays
I have a method that calculates the difference
between two dates; todays date and a returndate for
Library-books. I have a instance-method with the
get-method mentioned below. But I can't figure out
what call I must use so the program runs properly.
Any hints ?
See code below.
import java.io.*;
import java.util.*;
import java.text.*;
public class DateGet{
public static void main(String[] args) throws
IOException, ParseException{
System.out.print(LabMetoder.numberOfDays(days));
//This call is wrong, what should I write ?
}// end main
public static int numberOfDays (int days) {  
String aLine, returnDate;
Date today = new Date(); // gets todays date
SimpleDateFormat dateFormat = new
SimpleDateFormat("yyyyMMdd");
Book checkDate;
Scanner fin = new Scanner (new
FileReader("book.txt")); //open infile
while (fin.hasNext()) {
aLine=fin.nextLine();//reads first line
checkDate = new Book (aLine);//creates object
if (checkDate.getReturnDate()!=null) { // checks that
returnDate-field
// isn't empty
String oldDay = (checkDate.getReturnDate());
Date oldDayD = dateFormat.parse(oldDay); //changes
oldDay to a
//Dateobject
days = (int)( (today.getTime() - oldDayD.getTime())/
(1000*60*60*24));
//Calculates the difference between todays date and
returnDate System.out.println(days);//writes
dateobject on screen (this is
          // a check)
} //end if
}// end while
fin.close(); //closes book.txt
return days;
}//end NumberOfDaysOK, here is the message again. Thanks.
I have a method that calculates the difference between two dates; todays date and a returndate for Library-books. I have a instance-method with the get-method mentioned below. But I can't figure out what call I must use so the program runs properly. Any hints ?
See code below.
import java.io.*;
import java.util.*;
import java.text.*;
public class DateGet{
public static void main(String[] args) throws IOException, ParseException{
System.out.print(LabMetoder.numberOfDays(days));
//This call is wrong, what should I write ?
}// end main
public static int numberOfDays (int days) {
String aLine, returnDate;
Date today = new Date(); // gets todays date
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMdd");
Book checkDate;
Scanner fin = new Scanner (new FileReader("book.txt")); //open infile
while (fin.hasNext()) {
aLine=fin.nextLine();//reads first line
checkDate = new Book (aLine);//creates object
if (checkDate.getReturnDate()!=null) { // checks that returnDate-field
// isn't empty
String oldDay = (checkDate.getReturnDate());
Date oldDayD = dateFormat.parse(oldDay); //changes oldDay to a
//Dateobject
days = (int)( (today.getTime() - oldDayD.getTime())/
(1000*60*60*24));
//Calculates the difference between todays date and returnDate System.out.println(days);//writes dateobject on screen (this is
// a check)
} //end if
}// end while
fin.close(); //closes book.txt
return days;
}//end NumberOfDays

Similar Messages

  • I want to transfer all my iPhoto, iTunes, contacts, etc. files from my MacBook, which I am selling to a MacBook Pro. What is the easiest and safest method of achieving this? Can the files backed up on Time Machine be transferred to the Pro?.

    I want to transfer all my iPhoto, iTunes, contacts,documents, etc. files from my MacBook, which I am selling, to a MacBook Pro. What is the easiest and safest method of achieving this? Can the files backed up on Time Machine from the MacBook be transferred to the Pro in some way? I would like to capture the files as they appear on the MacBook, such as "Events" in iPhoto and the various song categories within iTunes without having to rename them all once saved on the Pro, which is the case with photos when I simply save them to thumb drive and import them to the Pro. Sny advice would be appreciated.
    Best regards,
    Rob.

    Michael,
                 Thanks for all your assistance. There is no need for apologies, Migration Assistant did indeed create a second account for the MacBook data. It has just taken me some time to figure out how to access it. I now have all the MB data in one account and the MBP files in another, which suits me fine. In fact, it is an advantage in my case as it keeps the private and business aspects separated.
    I will however try the fatcatsoftware to transfer all the iPhoto files to my iMac, where I keep my main photo library. and it will be of help to keep the events, etc in the transfer. As far as iTunes is concerned, I have HomeSharing on all my computers and this has obviated the need to worry about playlists being transferred successfully. However, HomeSharing did not appear to share the iPhone/iPod apps that were stored on the MB and although these have now come across with the new MacBook account on the MBP, I was wondering whether my iPhone and iPod will be recognised by the MBP and sync with it? Will I need to have the MB account open to achieve this or will the MBP recognise and sync with the iPhone/iPod automatically irrespective of which account is open?
    Thanks for the tip on deauthorising my iTunes account from the MB before sellng. This I will do and I believe the best way to remove all of my data from the hard drive is to reinstall the MacOSX operating system software. Is this the right approach to securely delete everything?
    Thanks again for sharing your expertise and your guidance through this exercise.
    Best regards,
    Rob.

  • Vector, what is the problem with this code?

    Vector, what is the problem with this code?
    63  private java.util.Vector data=new Vector();
    64  Vector aaaaa=new Vector();
    65   data.addElement(aaaaa);
    74  aaaaa.addElement(new String("Mary"));on compiling this code, the error is
    TableDemo.java:65: <identifier> expected
                    data.addElement(aaaaa);
                                   ^
    TableDemo.java:74: <identifier> expected
                    aaaaa.addElement(new String("Mary"));
                                    ^
    TableDemo.java:65: package data does not exist
                    data.addElement(aaaaa);
                        ^
    TableDemo.java:74: package aaaaa does not exist
                    aaaaa.addElement(new String("Mary"));Friends i really got fed up with this code for more than half an hour.could anybody spot the problem?

    I can see many:
    1. i assume your code snip is inside a method. a local variable can not be declare private.
    2. if you didn't import java.util.* on top then you need to prefix package on All occurance of Vector.
    3. String in java are constant and has literal syntax. "Mary" is sufficient in most of the time, unless you purposly want to call new String("Mary") on purpose. Read java.lang.String javadoc.
    Here is a sample that would compile...:
    public class QuickMain {
         public static void main(String[] args) {
              java.util.Vector data=new java.util.Vector();
              java.util.Vector aaaaa=new java.util.Vector();
              data.addElement(aaaaa);
              aaaaa.addElement(new String("Mary"));
    }

  • What is the use of finalized method ..even though

    we know that java has inbuild garbage collector. then what is the need of finalized method.
    can any one give me the answer please

    The original idea was that you could use finalize() to clean up class-variable resources. For example, you might be (shudder) holding on to a database connection in a given object. The idea would be that you could close the connection within finalize().
    However, and I am not totally sure on this, but there seems to be a few issues around finalize() getting called by the garbage collector. There are also a few posts I remember admonishing programmers not to call finalize() explicitly. So, for me at least, I do not use the method and ensure I clean up any resources I have references to manually.
    - Saish

  • What is the purpose of Static methods inside a class?

    Hi,
    What is the purpose of Static methods inside a class?
    I want the answers apart from "A static method does not require instance of class(to access) and it can directly be accessed by the class name itself"
    My question is what is the exact purpose of a static method ?
    Unlike attributes, a separate copy of instance attributes will be created for each instance of a class where as only one copy of static attributes will be created for all instances.
    Will a separate copy of instance method be created for each instance of a class and only one copy of static methods be create?
    Points will be rewarded for all helpful answers.

    Hi Sharma,
    Static methods is used to access statics attributes of a class. We use static attributes when we want to share the same attribute with all instances of a class, in this case if you chage this attribute through the instance A this change will change will be reflected in instance B, C........etc.
    I think that your question is correct -> a separate copy of instance method will be created for each instance of a class and only one copy of static methods be create ?
    "A static method does not require instance of class(to access) and it can directly be accessed by the class name itself"
    Static Method: call method class=>method.
    Instance Method: call method instance->method.
    Take a look at this wiki pages.
    [https://wiki.sdn.sap.com/wiki/x/o5k]
    [https://wiki.sdn.sap.com/wiki/x/ZtM]
    Best regards.
    Marcelo Ramos

  • What is the use of this form?

    Hi all,
    What is the use of this form in include RV61B901?
    How does this code send any information to the program calling it? Is Sy-subrc global so that main program will know the reuslts?
    Code:
    FORM KOBED_901.
      DATA : l_anzpk LIKE likp-anzpk.
      SELECT SINGLE anzpk FROM likp
                          INTO l_anzpk
                          WHERE vbeln = komkbv2-vbeln.
      IF l_anzpk NE 0.
        sy-subrc = 4.
        exit.
      ENDIF.
      sy-subrc = 0.
    ENDFORM.
    Thanks,
    Charles.

    Hello,
    This form sets the value of sy-subrc(which is global) based
    on the value of l_anzpk.
    Regards
    Greg Kern

  • What is the different between payment methods Wire and EFT

    Hi All
    can anybody tell me What is the different between payment methods Wire and EFT ?
    Regards ;

    WIRE:
    Wire is transfer of amount due directly to the supplier's bank it is an electronic transfer of funds
    This mode of payment is used for international suppliers.
    It can be paid in foreign currency or USD.
    Wire payments are same day payments.
    EFT:
    EFT ensures funds transfer from one bank account to another using electronic links.
    Can be used to make payments into domestic banks (within US) in USD only.
    It is faster than check payments.
    Hope this helps.

  • What's the problem in this code

    import java.lang.reflect.*;
    import java.awt.*;
    class ABC
         public Integer i;
         ABC()
         public void setInt(Integer t)
              i = t;
    public class SampleName {
    public static void main(String[] args)
    ABC g1 = new ABC();
    g1.setInt(new Integer(10));
    printFieldNames(g1);
    static void printFieldNames(Object o) {
    Class c = o.getClass();
    Field[] publicFields = c.getDeclaredFields();
    for (int i = 0; i < publicFields.length; i++)
    try {
    Object ref = publicFields.get(c);
    System.out.println(" ref.toString() : " + ref.toString());
         }catch(Exception e)
                   e.printStackTrace();
    What is the problem with this code,at run time Iam getting this exception
    java.lang.IllegalArgumentException: object is not an instance of declaring class
    How can we get the value of field of an object

    Now it got this exception
    java.lang.IllegalAccessException
    at java.lang.reflect.Field.get(Native Method)That's strange - I didn't! ;-)
    Are you running exactly the same code as the code you posted (except for the one line I said to change)?

  • What is the purpose of this (?=) ?

    hi friends...
    I am practising the WDA programs...
    in that they hav used this code
    data wd_table type ref to cl_wd_table.
    wd_table ?= view->get_element( 'TABLE' ).
    wd_this->table_control ?= wd_table->_method_handler.
    wd_this->table_control->set_key_attribute_name( 'MATNR' ).
    i don't know why they used this code...
    here  ( ?= ) what is the purpose of this ?= ?
    what is the purpose of this class cl_wd_table ?
    i am not clear with all statement, can you guide me..
    i am waiting for ur reply
    regards
    Deva

    ?= this is called downcast or narrow casting operator in abap.
    The purpose of this is assignment between reference variables in which the static type of the target varible more specific than the static type of the source varible.
    Check this link, hope it helps !
    [https://help.sap.com/saphelp_nw70ehp1/helpdata/en/c3/225b5f54f411d194a60000e8353423/frameset.htm]
    Radhika.

  • What is the difference between base method 0002 and 0011

    Hi,
    could you please explain what is the difference between base method 0002 and 0011?
    0002: Ordinary: no automatic depreciation
    0011: Ordinary: percentage from useful life
    if we assing base method: 0002 in dep. key? what will happen in future?
    if we assing base method: 0011 in dep. key? what will happen in future?
    please clarify my doubt.?
    Thanks
    Indu

    Let me clear, I have bought WinSL 8.1 SNGL OLP NL Acdmc Legalization GetGenuine (part
    No - 4HR-00400). It means my machine has legal OS and I can use it and I dont need to buy WinPro
    8.1 SNGL Upgrd OLP NL Acdmc (Part no. - FQC-08173).
    is it?
    I believe that is correct. There should be no reason to buy both licenses for one machine. You should verify this with your reseller or MS.
    Don
    (Please take a moment to "Vote as Helpful" and/or "Mark as Answer", where applicable.
    This helps the community, keeps the forums tidy, and recognises useful contributions. Thanks!)

  • MM - PO - what is the meaning of this button?

    Dear friends,
    Could anybody help me with one question.
    There is a strange button in a Purchasing Order on the Account Assignment tab page on this screenshot (it is marked with red color).
    Screenshot below
    http://content.foto.mail.ru/mail/raiden87/81/i-84.jpg
    What is the meaning of this button? When it is used for?
    I hope that anybody knows the meaning =)

    hi raiden,
    as for as i have gone through the issue I have come to know that:
    If you want to use multiple account assignment for a line item in PO then at that moment you will have to first press the "repeat on " button. only after that multiple account button will be active that is just before your "repeat on " button.
    Steps:
    1:Save your PO.
    2:Go to transaction code ME22N to change the PO.
    (Here you will firstly see that the multiple a/c assignment button is firsty gray.It will become active only after when you press the "repeat on" button).
    I hope It will be helpfull for you.
    regards,
    Aslam Ansari.

  • So I have an iPad with the smart cover, and it's usually supposed to turn on the iPad when u open it, but it's no doing that for me. Nor is it turning off without pressing the button. What is the meaning of this?

    So I have an iPad with the smart cover, and it's usually supposed to turn on and off the iPad when u open it and close it, but it's not turning on for me. Nor is it turning off without pressing the button. What is the meaning of this?what caused it to be this way? Is there someway that I could fix it?

    Wait a sec did this just start?
    You set up the smart cover function in settings (you did that, right?) so, if you did that and it's failed you make an appointment at your nearest Genius Bar now.

  • My Ipod touch is frozen.  Shows USB cable with arrow pointing to Itunes.  What is the problem?  This is the second one I have had that has done this!

    My Ipod touch is frozen.  The screen shows only USB cable with arrow point to the word Itunes.  What is the problem?  This is the second touch I have had that has this same problem.  HELP!

    This time try restoring the iPod to factory defaults/new iPod instead of from backup.  You may have some corruption that is causing the problem and it may now be in the backup.  If the problem persists after restoring to factory defaults/new iPod. then you likely have a hardware problem and ana ppointment at the Genius Bar of an Apple store is in order.

  • What is the wrong in this PL/SQL  block

    Hi a...
    Can you please tell what is the wrong in this pl/sql block.
    declare
    TYPE TYP_NT_NUM IS TABLE OF NUMBER ;
    v_tab TYP_NT_NUM := TYP_NT_NUM();
    TYPE uname is VARRAY(30) of varchar2(100) ;
    usr uname := uname ( 'u1','u2','u3','u4' );
    TYPE pwd is VARRAY(30) of varchar2(100) ;
    psw pwd := pwd('p1','p2','p3','p4');
    x number(10):=0;
    Cursor fcid IS Select distinct FC_ID From FCMASTER ;
    Begin
    Open fcid ;
    --for ii in usr.first .. usr.last loop
         Loop
              Fetch fcid Into x ;
              Exit When fcid%NOTFOUND ;
              v_tab(fcid%ROWCOUNT) := x ;
         End loop ;
         For iii IN v_tab.FIRST .. v_tab.LAST Loop
              dbms_output.put_line(v_tab(iii).FC_ID) ;
              End loop ;
    End loop; End of outer loop
    End;
    The error is
    Error
    [row:28,col:36] ORA-06550: line 28, column 36:
    PLS-00487: Invalid reference to variable 'NUMBER'
    ORA-06550: line 28, column 4:
    PL/SQL: Statement ignored
    Thanks in advance,
    Pal

    v_tab(iii).FC_ID
    declare
      type typ_nt_num is table of number;
      v_tab typ_nt_num;
    begin
      select distinct object_id bulk collect into v_tab from all_objects where rownum <= 10;
      for i in 1 .. v_tab.count loop
        dbms_output.put_line(v_tab(i)) ;
      end loop ;
    end;
    /

  • I am trying to listen BBC radio news from BBC App, but on pressing the button I always get the error "there was an error playing this radio feed". What is the source of this error and how can I remove it?

    I am trying to listen BBC radio news from BBC App, but on pressing the button "live radio" I always get the error "there was an error playing this radio feed". What is the source of this error and how can I remove it?

    That is probably just a generic error message and you might not ever know what is causing it. Assuming that you have been able to play live radio with the app in the past (I know nothing about the app) and assuming that all other Internet related functions (Safari, email, etc.) are working properly on your iPad, quit the app completely and reboot your iPad.
    Go to the home screen first by tapping the home button. Double tap the home button and the recents tray will appear with all of your recent apps displayed at the bottom. Tap and hold down on any app icon until it begins to wiggle. Tap the minus sign in the upper left corner of the app that you want to close. Tap the home button or anywhere above the task bar.
    Reboot the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple Logo appears - ignore the red slider if it appears on the screen - let go of the buttons. Let the iPad start up.
    If that fails to resolve the issue, you might want to reboot your router, unplug it for about 30 seconds and then plug it in again.

Maybe you are looking for

  • Same nr range in Logistics Invoice Verification for the MM and FI document

    I customised Logistics Invoce verification (on ECC6) with the same nr range for MM and FI.  That were done by changing the nr range of doc type RE (in FI) to nr range 52 andcreated the nr range for the company code for fiscal year 2007 and 2008 (our

  • Brand new ipod Not working!!! =[ Help please...

    Ok I downloaded the latest version of Itunes, I reset the Ipod, but for some reason my computer when I conect the usb cable the "found new hardware" windows pops up, I do not have a software to install for Ipod and the only thing I can find on the we

  • Outer join with BETWEEN clause

    Hi All, I have 2 tables (A and B) which i need to join. I need all records from table A and matching records from the table B. below is the structure. TABLE A (total rows = 10) ROW_WID GL_DATE LOCATION_CODE TABLE B (total = 7) ROW_WID START_DATE END_

  • Operator interface memory leak

    Hello, Sorry, but my English is not very good. I have a big problem with my Interface Operator. The memory used by the executable increases according to executions. I joins(contacts) the code of my Interface Operator.   Thank you in advance for your

  • Problem in Uploading Data using a Tab Separated File?

    Hi All, I am trying to upload a file which tab separated containing customer and bank details and my file structure somewhat in the following manner. 10     21169     abcde     xyz     kdHDHLk     gdh     ghgah  (Customer Details) 20     21169     DE