Posts

Showing posts from 2019

Design an AWT application to check whether the number entered in textbox is prime or not.

Image
Source Code:- import java.awt.*; import java.awt.event.*; class Prime extends Frame implements ActionListener {         TextField tf1,tf2;         public Prime()         {                   setLayout(new FlowLayout());                 Label lb1=new Label("Enter Number:");                 Label lb2=new Label("The Number is:");                   tf1=new TextField(15);                 tf2=new TextField(15);          ...

Design an AWT application to calculate the factorial of a number.

Image
Source Code:- import java.awt.*; import java.awt.event.*; class Factorial extends Frame implements ActionListener {           TextField tf1,tf2;           public Factorial()           {                    setLayout(new FlowLayout());                    Label lb1=new Label("Enter Number:");                    Label lb2=new Label("Factorial is:");                      tf1=new TextField(15);           ...

Write a java program to calculate area of rectangle by passing and returning object as a parameter.

Image
Source Code:- import java.io.*; class rect {           rect(double n,double m)           {                    double l,b,area;                    l=n;                    b=m;                    area=l*b;                    System.out.println("Area of Rectangle :"+area);           }           public static void main(String arg[] )...

Write a java code to print a Alphabetic Pattern.

Image
Source Code:- import java.io.*; public class Pattern   {     public static void main(String[] args)     {         System.out.println("** Printing the pattern... **");         for (int i = 0; i < 4; i++)         {             int alphabet = 65;             for (int j = i; j >= 0; j--)             {                  System.out.print((char) (alphabet + j) + " ");             }             System.out.println();         }   ...

Write a Java code to input height (in inches) and convert it into feet and inches.

Image
Source Code:- import java.io.*; import java.util.*; class height {           height()           {                    int a,b,inch;                    Scanner s=new Scanner(System.in);                    System.out.println("Enter the Height in inches");                    inch=s.nextInt();                    a=inch/12;                    b=...

TO DRAW A SIMPLE 4 WAYS LANE TRAFFIC.

Image
SOURCE CODE :- #include<stdio.h> #include<reg51.h> void traffic(); sbit r1=P2^0; sbit r2=P2^3; sbit r3=P1^0; sbit r4=P1^3; sbit y1=P2^1; sbit y2=P2^4; sbit y3=P1^1; sbit y4=P1^4; sbit g1=P2^2; sbit g2=P2^5; sbit g3=P1^2; sbit g4=P1^5; void delay() {           int i,j;           for(i=0;i<300;i++)           {                    for(j=0;j<=300;j++)                    {                                }           } } void traffic() { ...