Skip to main content

Posts

Showing posts from December, 2019

Lab Programs Cycle III

Lab Programs Cycle III a) Construct a Java program to demonstrate class mechanism - Create a class that contains variables, methods, constructors and invoke those methods inside main(). b) Develop a Java program demonstrating the use of static variables, methods. c) Develop a Java program demonstrating the use of this keyword. d) Develop a Java program that implements method overloading. e) Develop a Java program that implements constructor overloading. f) Develop a Java program demonstrating the use of command-line arguments.

Lab Programs Cycle II

a) Develop a Java program that displays i) The roots of a quadratic equation ax 2 +bx+c=0 ii) The nature of roots by calculating the discriminate D. import java.util.Scanner; public class Roots  {     public static void main(String args[])     {         int a,b,c;         double root1,root2,discriminate;         Scanner sc = new Scanner(System.in);         System.out.print("Enter value for a : ");         a = sc.nextInt();         System.out.print("Enter value for b : ");         b = sc.nextInt();         System.out.print("Enter value for c : ");         c = sc.nextInt();         discriminate = b*b-4*a*c;         if(discriminate > 0)         { ...