Koti Syamala

Koti Syamala

Write a Java program that Implements stack ADT.

//Program to implement Stacks import java.util.*; import java.io.*; class Stack1 {             int t;             int a[]=new int[5];             Stack1()             {                         t=-1;             }             boolean isempty()             {                         return (t==-1);             }             boolean isfull()            …

Write a Java program that displays the number of characters, lines and words in a text file.

//Program to count number of lines,characters,and words in a text file import java.util.*; import java.io.*; class Cfile {             public static void main(String args[])throws IOException             {                         int nl=1,nw=0;                                    char ch;                         Scanner scr=new Scanner(System.in);                        …

Write a Java program that reads a file and displays the file on the screen, with a line number before each line.

//Program to print the contents of the file along with line number import java.util.*; import java.io.*; class Rfile {             public static void main(String args[])throws IOException             {                         int j=1;                         char ch;                         Scanner scr=new Scanner(System.in);…

(Using java.lang.FileInputStream and FileOutputStream) a) Write a Java program that reads a file name from the user, then displays information about whether the file exists, whether the file is readable, whether the file is writable, the type of file and the length of the file in bytes.

//Program to read a file and display its properties import java.io.*; import java.util.*; import javax.swing.*; class Fileproperties {             public static void main(String args[])throws IOException             {                         Scanner scr=new Scanner(System.in);                         System.out.print(“nEnter any file name: “);                         String str=scr.nextLine();…

Write a Java Program that reads a line of integers, and then displays each integer, and the sum of all the integers (Use StringTokenizer class of java.util)

//Program to print the read numbers and find sum import java.util.*; class Sumtoken {             public static void main(String args[])             {                         Scanner scr=new Scanner(System.in); System.out.println(“nEnter sequence of integers with space b/w them and press enter : “);                        …

Write a Java program to multiply two given matrices.

//Program to find matrix multiplication import java.util.*; class Matrixmul {             public static void main(String args[])             {                         Scanner scr=new Scanner(System.in);                         int m,n,p,q;                         System.out.println(“nEnter the order of the Matrix A: “);                         m=scr.nextInt();                         n=scr.nextInt();                         int…

Write a Java program that prompts the user for an integer and then prints out all prime numbers up to that integer.

//Program to print prime numbers upto given integer import java.util.*; class Prime {             public static void main(String args[])             {                         int n,f;                         Scanner scr=new Scanner(System.in);                         System.out.println(“nEnter n value:  “);                         n=scr.nextInt();                         System.out.println(“nPrimenumbers are : “);…

The Fibonacci sequence is defined by the following rule: The fist two values in the sequence are 1 and 1. Every subsequent value is the sum of the two values preceding it. Write a Java program that uses both recursive and non recursive functions to print the nth value in theFibonacci sequence.

//Program to print nth value in the fibonacci series import java.util.*; class Function {                      void nrcf(int a,int b,int c,int n)             {                         for(int i=1;i<=n-2;i++)                         {                                     c=a+b;                                     a=b;                                     b=c;                         }                         a=b=1;                         System.out.println(“nth…

Write a Java program that prints all real solutions to the quadratic equation ax2 + bx + c = 0. Read in a,b, c and use the quadratic formula. If the discriminant b2 -4ac is negative, display a message stating that there are no real solutions.

//Program to find roots of a quadratic equations import java.util.*; class Roots {             public static void main(String args[])             {                         int a,b,c,d,f=0;                         Scanner scr=new Scanner(System.in);                         System.out.println(“nEnter the values of a ,b ,c : “);                         a=scr.nextInt();…

Motion Capture Technology

Motion capture is defined as “The creation of a 3D representation of a live performance.” The use of motion capture to animate characters on computers is relatively recent, it started in the 1970s, and now just beginning to spread.Motion capture…

Enable Notifications OK No thanks