1. Write a program to print “Hello Java” (enclosed within double quotes) on the standard output.
2. Write a Java program that calculates and prints the simple interest using the formula :
Simple Interest = PTR / 100 input values P,T,R should be accepted as command line input as below.
e.g. java Simple Interest 5 10 15
3. Write a program to compute sum of digits of a given number.
(Hint: Separate digits one by one from the number and then add)
4. Write a program that prints prime numbers between 1 to n. Number n should be accepted as command line input
5. Write a program that converts a decimal number to Roman number. Decimal Number is accepted as command line input at the time of execution.
6. WAP to to print following pattern (Pascals Triangle)
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
7. Write a Java program that accepts the radius of a circle and displays the options as follows :
1. find diameter of a cicle.(2* radius)
2. find area of circle.( _ * radius * radius)
3. find circumference of a circle.( 2 * _ * radius)
4. exit.
Use case statement to implement each option and display the corresponding output. 8. Define a class called fruit with the following attributes :
1. Name of the fruit.
2. Single fruit or bunch fruit.
3. Price.
Define a suitable constructor and displayFruit() method that displays values of all the attributes. Write a program that creates 2 objects of fruit class and display their attributes.
9. Write a program to find the Factorial of a number using Recursion. Factorial can be defined as Factorial(n) = 1 * 2 * 3 ….* (n-1) * n.
10. WAP to print the sum of Harmonic Series: Input=3
Output=1/1+1/2+1/3=1.83333333..
11. WAP to display the following output 1 2 4 3 6 9
4 8 12 16
5 10 15 20 25
12. WAP to display the entered number in word. Input: 123 Output: One Two Three