Sunday, September 30, 2012

Java Exercise #8: Compute Loan Payments

This exercise is write a program that computes the loan payments. The loan can be car loan, home loan or student loan

Exercise: Write a program that takes inputs from user for the loan amount, interest rate and tenure and then computes the monthly and total payments

Enter loan amount (Eg: 60000.5): 250000
Enter annual interest rate (Eg: 8.25): 5.75
Enter number of years (Eg: 5): 15

Monthly payment is : 2076.02
Total payment is : 373684.53


Download Code: Compute Loan

Saturday, September 29, 2012

Java Exercise #7: Read From Console

This exercise is write a program using Scanner class to read from Console

Exercise: Write a program that reads from Console and then prints the same to the console

Enter an integer: 10
You input integer: 10

Enter a double: 15.3
You input double: 15.3

Enter a string without space: Hello
You input string: Hello

Download Code: Read From Console

Friday, September 28, 2012

Java Exercise #6: Sales Tax

This exercise is to print a decimal calculation with 2 decimal places

Exercise: Print the sales tax for purchase amount of 197.55 @ 6% interest with 2 decimal places.

Sales tax for purchase amount of 197.55 @ 6% is 11.85

Download Code: Salex Tax

Thursday, September 27, 2012

Java Exercise #5: Display Time

This exercise is to determine the number of minutes and seconds in a given amount of time in seconds.

Exercise: This exercise is to determine the number of minutes and seconds in a given amount of time in seconds.

500 seconds is 8 minutes and 20 seconds

Download Code: Display Time

Wednesday, September 26, 2012

Java Exercise #4: Area Of A Circle

This exercise is to calculate the area of circle for a given radius. Radius is hard coded in the exercise and is not input from the console by the user.

Exercise: Write a program that prints the area of circle for a given radius on Console.

Area of circle with radius: 10.0 is 314.159

Download Code: Circle Area

Tuesday, September 25, 2012

Java Exercise #3: Display Simple Pattern

This is a simple exercise to print a pattern on the console.

Exercise: Write a program that prints the following pattern on the Console.

 W           W W           W W           W
  W         W   W         W   W         W 
   W       W     W       W     W       W  
    W     W       W     W       W     W   
     W   W         W   W         W   W    
      W W           W W           W W     
       W             W             W     

Download Code: Display Pattern

Monday, September 24, 2012

Java Exercise #2: Hello World (Dialog Box)

This exercise is to print a message on Message Dialog Box.

Exercise: Write a program that prints 'Hello World!' on Message Dialog Box.

Download Code: Hello World

Sunday, September 23, 2012

Java Exercise #1: Hello World (Customary)

This is my first post in the new initiative of doing atleast one Java Exercise daily and it has to be Hello World! I am working with Java for close to 6 years now and intends to get better at it.

Exercise: Write a program that prints 'Hello World!' on Console

Hello World!

Download Code: Hello World