Computer Science, asked by roshanimhatre2001, 10 months ago

develop advanced java program to accept two numbers and display their product when user pressed multiply button​

Answers

Answered by vishalrkjeur019
16

Answer:

import java.awt.*;

import java.awt.event.*;

import java.applet.*;

public class Q2 extends Applet implements ActionListener

{

TextField t1 = new TextField(10);

TextField t2 = new TextField(10);

TextField t3 = new TextField(10);

Label l1 = new Label("FIRST NO=:");

Label l2 = new Label("SECOND NO:");

Label l3 = new Label("SUM:");

Button b = new Button("ADD");

public void init()

{

t1.setForeground(Color = Red);

add(l1);

add(t1);

add(l2);

add(t2);

add(l3);

add(t3);

add(b);

b.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

if (e.getSource() == b)

{

int n1 = Integer.parseInt(t1.getText());

int n2 = Integer.parseInt(t2.getText());

t3.setText(" " + (n1 * n2));

}

}

}

Answered by syed2020ashaels
0

Java programs are often asked in an interview. These programs can be asked from check statements, array, string, oops etc. Basic Java programs like fibonacci series, prime numbers, factorial numbers and palindrome numbers are often asked in interviews and exams. All these programs are listed with the maximum number of examples and outputs.

Java is a general-purpose, class-based, object-oriented programming language designed to have fewer implementation dependencies. It is a computing platform for application development. Java is therefore fast, secure and reliable. It is widely used to develop Java applications in notebooks, data centers, game consoles, scientific supercomputers, mobile phones, etc.

Code of the given question:

import java.awt.*;

import java.awt.event.*;

import java.applet.*;

public class Q2 extends Applet implements ActionListener

{

TextField t1 = new TextField(10);

TextField t2 = new TextField(10);

TextField t3 = new TextField(10);

Label l1 = new Label("FIRST NO=:");

Label l2 = new Label("SECOND NO:");

Label l3 = new Label("SUM:");

Button b = new Button("ADD");

public void init()

{

t1.setForeground(Color = Red);

add(l1);

add(t1);

add(l2);

add(t2);

add(l3);

add(t3);

add(b);

b.addActionListener(this);

}

public void actionPerformed(ActionEvent e)

{

if (e.getSource() == b)

{

int n1 = Integer.parseInt(t1.getText());

int n2 = Integer.parseInt(t2.getText());

t3.setText(" " + (n1 * n2));

}

}

}

brainly.in/question/5918683

#SPJ5

Similar questions