Skip to content

Latest commit

 

History

History
49 lines (42 loc) · 3.4 KB

JodaTimeDonor.md

File metadata and controls

49 lines (42 loc) · 3.4 KB

Running the donor.java file

Link for code - Donor.java

Question

Write a program to demonstrate the knowledge of students in File handling

Eg., Define a class ‘Donor’ to store the below mentioned details of a blood donor. Name, age, Address, Contact number, blood group, date of last donation Create ‘n’ objects of this class for all the regular donors at Vellore. Write these objects to a file. Read these objects from the file and display only those donors’ details whose blood group is ‘A+ve’ and had not donated for the recent six months.

Instructions

Note: Please use an IDE to run this code.

Ecilpse

Source for instructions

  1. Create your java project in eclipse
  2. Download the latest JodaTime .tar.gz file, and extract its contents
  3. In Eclipse look for your project at package explorer and right click on it then call it New -> Folder -> libs
  4. Copy/Drag joda-time-2.1.jar into the new created libs folder
  5. Right click on your project again (in package explorer) then Properties -> Java Build Path -> Libraries -> Add Jars -> joda-time-2.1.jar Now you can test with this code : DateTime test = new DateTime(); if code compiled ok you are good to go

OR

Source for instructions You can add the jar files in this folder manually.

  1. You can add a jar in Eclipse by right-clicking on the Project -> Build Path -> Configure Build Path. Under Libraries tab, click Add Jars or Add External JARs and give the Jar. A quick demo here.

    instructions

  2. The above solution is obviously a "Quick" one. However, if you are working on a project where you need to commit files to the source control repository, I would recommend adding Jar files to a dedicated library folder within your source control repository and referencing few or all of them as mentioned above.

IntelliJ Idea

Source for instructions

  1. Download the .zip file
  2. Click File from the toolbar on IntelliJ IDEA
  3. Project Structure (CTRL + SHIFT + ALT + S on Windows/Linux, ⌘ (CMD) + ; on Mac OS X)

    instructions

  4. Select Modules at the left panel
  5. Dependencies tab
  6. '+' → JARs or directories

Netbeans

Source for instructions

  1. In the Projects window right-click on the name of the project -> Properties -> Project Properties window opens.
  2. In Categories tree select "Libraries" node -> On the right side of the Project Properties window press button "Add JAR/Folder" -> Select jars you need.