CoreJAVA Practicals
CoreJAVA Practicals
PART I (Data types, Operators and Assignments, Loops, Array and String
A. Write a java program to implement following task. 1. Reverse Number using Java
2. Factorial Using Recursion 3. Swap Numbers 4. Swap Numbers Without Using Third Variable 5. Find Even Odd Number 6. Find Largest and Smallest Number in an Array 7. Calculate Circle Area 8. Calculate Circle Perimeter 9. Calculate Rectangle Area (Using Command Line Arguments) 10. Calculate Rectangle Perimeter (Using Command Line Arguments) 11. Implements all the Arithmetic operators 12. Implements Bitwise operators. 13. Implements Increment and Decrement operators 14. Implements Left-Shift, Right-Shift and Unsigned Right-Shift operators 15. Implements Narrowing and widening conversions. 16. Implements type conversion (String to all data types) B. Write a program to display a random choice from a set of six choices for fruit
(Apple, Banana, Watermelon, Orange, Pineapple)
A. A lottery requires that you select six different numbers from the integers 1 to
49. Write a program to do this for you and generate five sets of entries.
E.
Create an array of String variables and initialize the array with the names of the months from January to December. Create an array containing 12 random decimal values between 0.0 and 100.0. Display the names of each month along with the corresponding decimal value. Calculate and display the average of the 12 decimal values. F. Write a program to create a rectangular array containing a multiplication table from 1 * 1 up to 12 * 12. Output the table as 13 columns with the numeric values right- aligned in the columns. (The first line of output is the column headings, the first column with no heading, then the numbers 1 to 12 for the remaining columns. The first item in each of the succeeding lines is the row heading, which ranges from 1 to 12.) G. Define an array of ten String elements each containing an arbitrary string of the form "month/day/year"; for example,"10/29/99" or "12/5/01". Analyze each element in the array and output the date represented in the form 29th October 1999. H. Write a program that reverses the sequence of letters in each word of your chosen paragraph. For instance, "To be or not to be." becomes "oT eb ro ton ot eb."
2 3
4 5 6