Sunday, April 3, 2011

File - java.io.File

The following program displays the Free Space in various sizes of measurement Byte,KB,MB and GB for a particular drive.

package file_pkg;
import java.io.*;

public class file_cnt_words {

    public static void main(String args[]) throws IOException
    {
       
       
        File file;
        file=new File("D:/2011/Java Examples/files/file_txt.txt");
        //D:/2011/Java Examples - getPath(); - get the path shows "PACKAGE FOLDER"
       
        //file=new File("files/file_txt.txt");
        sop(file.getAbsolutePath()); // Complete path
        // Find Space on HDD
        sop("Free Space in Drive is : "+file.getFreeSpace()+"Bytes");
        sop("Free Space in Drive is : "+file.getFreeSpace()/1024+" KB");
        sop("Free Space in Drive is : "+file.getFreeSpace()/1024/1024+" MB");
        sop("Free Space in Drive is : "+file.getFreeSpace()/1024/1024/1024+" GB");
            
       
       
    }
    static public void sop(Object input)
    {
        System.out.println(input);
       
    }
}

Thursday, March 31, 2011

Gospel : Be Not Afraid

You shall cross the barren desert, but you shall not die of thirst.
You shall wander far in safety though you do not know the way.
You shall speak your words in foreign lands and all will understand.
You shall see the face of God and live.

Chorus
Be not afraid.
I go before you always.
Come follow me, and
I will give you rest.


If you pass through raging waters in the sea, you shall not drown.
If you walk amid the burning flames, you shall not be harmed.
If you stand before the pow'r of hell and death is at your side, know that
I am with you through it all.


Blessed are your poor, for the kingdom shall be theirs.
Blest are you that weep and mourn, for one day you shall laugh.
And if wicked men insult and hate you all because of me, blessed, blessed are you!

Saturday, March 19, 2011

Lent Song: O Cross Erected Above The World

O Cross Erected Above The World
Cross of our Saviour King! (2)

Fount from which gushed the waters
Straight from the wound in his side
Filling our lives with his gift of grace
Cross of our Saviour King

O Cross sublime and refulgent tree,
Cross of our Saviour King! (2)

Jesus through thee has saved us,
Great was the price that he paid
Thou art the folly of love divine
Cross of our Saviour King!

O Cross, thou channel of grace divine,
Cross of our Saviour King! (2)

Tree on which death was conquered
Thou the first altar of love
Jesus, the Lamb gave his life to thee,
Cross of our Saviour King!

O Cross Erected Above The World
Cross of our Saviour King! (2)

Tuesday, March 8, 2011

Sunday, March 6, 2011

Problem Solving : Compund Interest

Write a Java Program to calculate Compound Interest for the following cases.
  1. A customer invests Rs 1000 in a bank that offers a ROI(Rate of Interest) of 8% per annum.
  2. Calculate the Amount at the end of the 1st year
  3. Calculate the Amount at the end of the 3rd month.
  4. Calculate the amount at the end of 20 days.
  5. Calculate the number of months/days/yrs when the amount would double, triple and four times.
  6. Calculate the amount,years/days/months the Customer would have to invest to earn Rs 10,000.
  7. Calculate the Principle Min-Max Rate of Interest(ROI) at which the customer would be able to earn 10,000 for each year over a period of 5 years.
  8. Investor invests(tops up) 100Rs every month, calculate the amount at the end of year,2 months and 50 days Rate of Interest 8%.