Easy to Code
Easy to Code
  • Home
  • Programs
    • Python
    • C Programs
      • BCA C Program
      • C Structure
    • Java Programs
    • Data Structure
    • C++ Programs
  • Sitemap
  • Privacy Policy
  • About Us
  • Contact Us
import java.util.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class MySwing extends JFrame
{
Random rand;
Color randomColor;
MySwing()
{
super("Change Color");
setLayout(new FlowLayout());

setSize(500,500);
setVisible(true);
addWindowListener(new MyClose());
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
}
class MyClose extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
rand = new Random();
float r = rand.nextFloat();
float g = rand.nextFloat();
float b = rand.nextFloat();
randomColor = new Color(r, g, b);
repaint();
}
}

public void paint(Graphics g)
{
getContentPane().setBackground(randomColor);
}
}

class Slip14
{
public static void main(String[] args) {
MySwing obj= new MySwing();
}
}
 import java.applet.*;
import java.awt.event.*;
import java.awt.*;
//<applet code="Slip6" height=300 width=200></applet>
public class Slip6 extends Applet implements ActionListener
{
TextField t;
Button b[];
Panel p;
String c, arr[]={"1","2","3","+","4","5","6","-","7","8","9","*","0",".","=","/"};
double n1,n2,ans;
public void init()
{
t= new TextField(20);
b=new Button[16];
p= new Panel();
for(int i=0;i<16;i++)
b[i]=new Button(arr[i]);
p.setLayout(new GridLayout(4, 4, 10, 10));
p.setSize(700,1500);

}
public void start()
{
add(t);
for(int i=0;i<16;i++)
{
p.add(b[i]);
b[i].addActionListener(this);
}
add(p);
}
public void actionPerformed(ActionEvent ae)
{
switch (ae.getActionCommand())
{
case "1": insert("1"); break;
case "2": insert("2"); break;
case "3": insert("3"); break;
case "4": insert("4"); break;
case "5": insert("5"); break;
case "6": insert("6"); break;
case "7": insert("7"); break;
case "8": insert("8"); break;
case "9": insert("9"); break;
case "0": insert("0"); break;
case ".": insert("."); break;
case "+": addition(); break;
case "-": substract(); break;
case "*": multiply(); break;
case "/": divide(); break;
case "=": cal(); break;
}
}
void insert(String n)
{
if (t.getText().equals(""))
t.setText(n);
else
t.setText(t.getText()+n);
}
void addition()
{
n1=Double.parseDouble(t.getText());
t.setText(t.getText()+"+");
c="+";
}
void substract()
{
n1=Double.parseDouble(t.getText());
t.setText(t.getText()+"-");
c="-";
}
void multiply()
{
n1=Double.parseDouble(t.getText());
t.setText(t.getText()+"*");
c="*";
}
void divide()
{
n1=Double.parseDouble(t.getText());
t.setText(t.getText()+"/");
c="/";
}
void cal()
{
n2=Double.parseDouble(t.getText().substring(t.getText().indexOf(c)+1,t.getText().length()));
if(c.equals("+"))
{
t.setText(Double.toString(n1+n2));
n1=n1+n2;
}
if(c.equals("-"))
{
t.setText(Double.toString(n1-n2));
n1=n1-n2;
}
if(c.equals("*"))
{
t.setText(Double.toString(n1*n2));
n1=n1*n2;
}
if(c.equals("/"))
{
t.setText(Double.toString(n1/n2));
n1=n1/n2;
}
}
}
 /*
Write a java program to reverse the content of file using RandomAccessFile.
*/
import java.io.*;
import java.util.*;
class FileReverse
{
File f,f2;
String str;
FileReverse()
{
Scanner s=new Scanner(System.in);
System.out.println("Enter the source path: ");
String path=s.nextLine();
System.out.println("Enter the source name: ");
String name=s.nextLine();
f=new File(path,name);
}
void reverse()
{
try
{
RandomAccessFile file = new RandomAccessFile(f,"r");
long n= f.length()-1;
int i=0;
while (n>=0)
{
if (n==-1)
break;
else
{
file.seek(n);
i= file.read();
n=n-1;
System.out.print((char)i);
}
}
file.close();
}catch(Exception e)
{
System.out.print(e);
}
}
}
class TestFileReverse
{
public static void main(String args[])
{
FileReverse obj=new FileReverse();
obj.reverse();
}
}

 Preview- Click on image

Code-

Note - Save This File as index.html

<html>

<frameset rows="30%,*">

<frame src="heading.html">

<frame name="f3">

</frameset>

</html>

Note - Save This File as heading.html

<html>

<body>

<form>

<table  cellpadding=20 align=center>

<tr>

<td><img height=70px width=70px src="https://i.pinimg.com/originals/5f/9b/e5/5f9be5876eda5d373d7f91a8faf5e659.jpg"></td>

<td><font size=7>AirIndia</font></td>

<td><select>

<option value="India">India</option>

<option value="America">America</option>

<option value="Russia">Russia</option>

<option value="Malaysia">Malaysia</option>

</select>

</td>

</tr>

</table>

<table border=2 cellpadding=10 cellspacing=10  align=center>

<tr>

<td><font size=5><a href="home.html" target="f3">Home</a></font></td>

<td><font size=5><a href="trip.html" target="f3">Manage Your Trip</a></font></td>

</tr>

</table>

</form>

</body>

</html>

Note - Save This File as home.html

<html>

<body>

<table border=2 align=center>

<tr><td>

<table cellspacing=10>

<tr><td colspan=3><h1>Booking Information</h1></td></tr>

<tr><td>From:</td><td colspan=2><input type="text">

<tr><td>To:</td><td colspan=2><input type="text">

<tr><td>Departure Date:</td><td colspan=2><input type="text">

<tr><td>Returning Date:</td><td colspan=2><input type="text">

<tr><td>Adults</td><td>Children</td>

<td rowspan=2>

<select>

<option value="Economy">Economy</option>

<option value="Executive">Executive</option>

<option value="First">First</option>

</select>

</td>

</tr>

<tr><td>

<select>

<option value="one">1</option>

<option value="two">2</option>

<option value="three">3</option>

<option value="four">4</option>

<option value="five">5</option>

<option value="six">6</option>

<option value="seven">7</option>

<option value="eight">8</option>

<option value="nine">9</option>

</select>

</td>

<td>

<select>

<option value="zero">0</option>

<option value="one">1</option>

<option value="two">2</option>

<option value="three">3</option>

<option value="four">4</option>

<option value="five">5</option>

<option value="six">6</option>

<option value="seven">7</option>

<option value="eight">8</option>

<option value="nine">9</option>

</select>

</td>

</tr>

<tr><td colspan=3 align=center><input type="button" value="Book Now"></td></tr>

</table>

</td></tr>

</table>

</body>

</html>

Note - Save This File as trip.html

<html>

<form>

<h1 align=center>Manage Your Trip</h1>

<p align=center><u>Fare Details for Air India</u></p>

<table align=center border=2 cellpadding=10>

<tr>

<th>Class</th>

<th>Fare</th>

</tr>

<tr>

<td>Economy</td>

<td>10,000/-</td>

</tr>

<tr>

<td>Executive</td>

<td>20,000/-</td>

</tr>

<tr>

<td>First</td>

<td>30,000/-</td>

</tr>

</table>

<h3 align=right><a href="home.html">Home</a><h3>

</form>

</html>


 Preview- Click on image


Code-

Note - Save This File as index.html

<html>

<frameset rows="20%,*">

<frame src="heading.html">

<frameset cols="20%,*">

<frame src="link.html">

<frame name="f3">

</frameset>

</frameset>

</html>

Note - Save This File as heading.html

<html>

<body>

<h2 align=right>logout</h2>

<h1 align=center><font size=7>Welcome to lvan Bayross</font></h1>

</body>

</html>

Note - Save This File as link.html

<html>

<body>

<h2><a href="home.html" target="f3">Home</a></h2>

<h2><a href="profile.html" target="f3">Profile</a></h2>

<h2><a href="friend.html" target="f3">Find Friend Request</a></h2>

</body>

</html>

Note - Save This File as home.html

<html>

<body>

<h2>Raj shared this link</h2>

<img height=300px width=500px src="https://s3.amazonaws.com/influencive.com/wp-content/uploads/2019/11/19170005/hiking-3775075_1280-e1574274140979.jpg"><br><br>

<input type="button" value="Like">

<input type="button" value="Share">

<input type="button" value="Comment">

</body>

</html>

Note - Save This File as profile.html

<html>

<body>

<h3 align=right><a href="home.html">Home</a><h3>

<h1>Profile Page</h1>

<img src="https://www.arihantayurveda.com/img/t2.jpg">

<p><font size=6>Ivan Bavross</font></p>

<input type=button value="Comment/Message"> <h3>Post <h3>

<p>Timeline  About  Friends</p>

</body>

</html>

Note - Save This File as friend.html

<html>

<body>

<h1>Find Friends Request</h1>

<img height=100px width=100px src="https://codex-themes.com/scalia/wp-content/uploads/2014/09/Faces-400x400px-1_1_18-300x300.jpg">

<p><font size=5>Priya Tyagyi</font>

<input type="button" value="Confirm">

<input type="button" value="Delete">

</p>

<img height=100px width=100px src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcT8RdsUdYf4NijOdfoAn94IAJve-p4RBoA2KA&usqp=CAU">

<p><font size=5>Michel Rock</font>

<input type="button" value="Confirm">

<input type="button" value="Delete">

</p>

<img height=100px width=100px src="https://encrypted-tbn0.gstatic.com/images?q=tbn%3AANd9GcQrnI1Xm61F1mJake8AdDHrlJqsAqV_vV7HgA&usqp=CAU">

<p><font size=5>Jessi Misel</font>

<input type="button" value="Confirm">

<input type="button" value="Delete">

</p>

</body>

</html>



Newer Posts Older Posts Home

Ads

Pages

ABOUT BLOG

EASY TO CODE

Welcome to Easy to Code, your number one source for all programs.Coding is used for communicating with computers so we're dedicated to providing you the very best solutions. We hope you enjoy our programs as much as we enjoy offering them to you. If you have any questions or comments, please don't hesitate to contact us.

POPULAR POSTS

  • Write a C++ program to create a class Employee which contains data members as Emp_Id, Emp_Name, Basic_Salary, HRA, DA, Gross_Salary. Write member functions to accept Employee information. Calculate and display Gross salary of an employee. (DA=12% of Basic salary and HRA = 30% of Basic salary) (Use appropriate manipulators to display employee information in given format :- Emp_Id and Emp_Name should be left justified and Basic_Salary, HRA, DA, Gross salary Right justified with a precision of two digits)
  • Write a C++ program to create a class which contains single dimensional integer array of given size. Write a member function to display even and odd numbers from a given array. (Use Dynamic Constructor to allocate and Destructor to free memory of an object)
  • Write a C program to accept dimensions length (l), breadth(b) and height(h) of a cuboids and display surface area and volume (Hint : surface area=2(lb+lh+bh ), volume=lbh )
  • Write C program to check whether a input number is Armstrong number or not.
  • Write a C program to accept temperatures in Fahrenheit (F) and display it in Celsius(C) and Kelvin (K) (Hint: C=5.0/9(F-32), K = C + 273.15)

Report Abuse

Translate

Tags

  • C BCA Practical
  • c program
  • cpp programs
  • DS
  • html
  • Java programs
  • Python Programs
  • VB.net

Slider

5/random/slider

Advertisement

Tags

Recent in Recipes

3/Food/post-list
  • Home
  • About
  • Contact
  • Home
  • Programs
  • BCA Practical Programs
  • __C Structure
  • __C++ Programs
  • __Data Structure
  • __HTML CSS JavaScript
  • __Java
  • _Python
  • _SiteMap
  • About US

Menu Footer Widget

  • Home
  • About
  • Contact Us

Popular Posts

  • Write a C program to accept temperatures in Fahrenheit (F) and display it in Celsius(C) and Kelvin (K) (Hint: C=5.0/9(F-32), K = C + 273.15)
    #include<stdio.h> #include<conio.h> void main() {    float fahrenheit,convert;    //Accept temperature      printf("\nEnter...
  • Write a menu driven program to perform the following operations on strings using standard library functions: 1. Length of String 2. Copy String 3. Connect Two Strings 4. Compare two strings
    #include<conio.h> #include<string.h> #include<stdio.h> //To get length of given string void lengthofstring() {    int leng...
  • Write a C program to accept dimensions of a cylinder and display the surface area and volume of cylinder.
    #include<conio.h> #include<stdio.h> void main() { float r,h,v,A; //declare variables r=radius, h=height , v=volume , A=area...

Labels

  • C BCA Practical33
  • c program2
  • cpp programs50
  • DS22
  • html8
  • Java programs22
  • Python Programs10
  • VB.net20

Pages

  • Data Structure
  • Python
  • Java Programs
  • C programs
  • C Structure
  • C++ Programs
  • BCA (2018) C Programs slip Solutions