4-Sem-GTU_Java_Practicals
List Of All Java Practicals/Programs: 3140705
(1) Write a Program that displays Welcome to Java, Learning Java Now and Programming is fun.
(2) Write a program that solves the following equation and displays the value x and y:1) 3.4x+50.2y=44.5 2) 2.1x+.55y=5.9 (Assume Cramer’s rule to solve equation ax+by=e x=ed-bf/ad-bc cx+dy=f y=af-ec/ad-bc )
(3) Write a program that reads a number in meters, converts it to feet, and displays the result.
(4)Body Mass Index (BMI) is a measure of health on weight. It can be calculated by taking yourweight in kilograms and dividing by the square of your height in meters. Write a program thatprompts the user to enter a weight in pounds and height in inches and displays the BMI.Note:- 1 pound=.45359237 Kg and 1 inch=.0254 meters.
(5) Write a program that prompts the user to enter three integers and display the integers in decreasingorder.
(6) Write a program that prompts the user to enter a letter and check whether a letter is a vowel orconstant.
(7) Assume a vehicle plate number consists of three uppercase letters followed by four digits. Write aprogram to generate a plate number.
(8) Write a program that reads an integer and displays all its smallest factors in increasing order. Forexample if input number is 120, the output should be as follows:2,2,2,3,5.
(9) Write a method with following method header.public static int gcd(int num1, int num2)Write a program that prompts the user to enter two integers and compute the gcd of two integers.
(10) Write a test program that prompts the user to enter ten numbers, invoke a method to reverse thenumbers, display the numbers.
(11) Write a program that generate 6*6 two-dimensional matrix, filled with 0’s and 1’s , display thematrix, check every raw and column have an odd number’s of 1’s.
(12) Write a program that creates a Random object with seed 1000 and displays the first 100 randomintegers between 1 and 49 using the NextInt (49) method.
(13) Write a program for calculator to accept an expression as a string in which the operands andoperator are separated by zero or more spaces.For ex: 3+4 and 3 + 4 are acceptable expressions.
(14) Write a program that creates an Array List and adds a Loan object , a Date object , a string, and aCircle object to the list, and use a loop to display all elements in the list by invoking the object’s toString() method.
(15) Write the bin2Dec (string binary String) method to convert a binary string into a decimal number.Implement the bin2Dec method to throw a NumberFormatException if the string is not a binarystring.
(16)Write a program that prompts the user to enter a decimal number and displays the number in afraction.Hint: Read the decimal number as a string, extract the integer part and fractional part from thestring.
(17) Write a program that displays a tic-tac-toe board. A cell may be X, O, or empty. What to display ateach cell is randomly decided. The X and O are images in the files X.gif and O.gif.
(18) Write a program that moves a circle up, down, left or right using arrow keys.
(19) Write a program that displays the color of a circle as red when the mouse button is pressed and as
blue when the mouse button is released.
Comments
Post a Comment