[PDF] [PDF] /* PROGRAM TO IMPLEMENT SIMPLE CALCULATOR USING AWT

PROGRAM TO IMPLEMENT SIMPLE CALCULATOR USING AWT*/ import java awt event *; public class Cal extends Applet implements ActionListener{



Previous PDF Next PDF





[PDF] /* PROGRAM TO IMPLEMENT SIMPLE CALCULATOR USING AWT

PROGRAM TO IMPLEMENT SIMPLE CALCULATOR USING AWT*/ import java awt event *; public class Cal extends Applet implements ActionListener{



[PDF] A Calculator Project

The Calculator class creates a UserInterface Class and a CalcEngine import java awt event *; Examples, with the decimal values at the right 1 0 1 1 0 1 (45)



[PDF] Simple Calculator Project Report Using Java - Ruforum

29 jan 2021 · code to make a simple calculator in java using awt this calculator works on two in java programming which performs the basic four mathematical operations i e 



[PDF] Java Programming Unit 5 - myflexorg

Calculator With FlowLayout (c) Yakov Fain 2014 import javax swing *; import java awt FlowLayout; public class SimpleCalculator { public static void 



[PDF] Java, Swing, and Eclipse: The Calculator Lab

(Some images were prepared with an earlier version of Eclipse and may not look exactly as they would with the Run the program (see Fig 3) • Save the file with Create a class DigitListener that implements the interface java awt event



[PDF] Calculator program in java using swing pdf - Squarespace

Java program to implement calculator using JFrame/ Swing With GUI – In this article we will detail on All JButton components start with jbn **/ import java awt



[PDF] JAVA PROGRAMMING - MRCET

B)Write a Java program compute factorial value using Applet 8 6 Write a java program that works as a simple calculator Use a Grid Layout to arrange Buttons  



[PDF] Model-View-Controller (MVC) Structure

structure/calc-mvc/CalcMVC java -- Calculator in MVC pattern import java awt event *; Controller in a real program, but this is a short example this



[PDF] Programming in Java - NIELIT

Design a Calculator using Java Applet/Swing The display should have all the digit buttons along with buttons for operations +,-,*, / and = There is a designated  

[PDF] calculator program in java using class and objects

[PDF] calculator program in java using do while loop

[PDF] calculator program in java using if else

[PDF] calculator program in java using inheritance

[PDF] calculator program in java using switch case

[PDF] calculatrice matrice casio

[PDF] calculatrice matrice de passage

[PDF] calculatrice matrice determinant

[PDF] calculatrice matrice inverse

[PDF] calculatrice matrice inverse en ligne

[PDF] calculatrice matrice online

[PDF] calculatrice matrice valeur propre

[PDF] calculatrice numworks acheter

[PDF] calculatrice numworks emulateur

[PDF] calculatrice numworks jeu

/* PROGRAM TO IMPLEMENT SIMPLE CALCULATOR USING AWT*/ import java.awt.*; import java.awt.event.*; import java.applet.*; public class Cal extends Applet implements ActionListener{

String msg=" ";

int v1,v2,result;

TextField t1;

Button b[]=new Button[10];

Button add,sub,mul,div,clear,mod,EQ;

char OP; public void init(){

Color k=new Color(120,89,90);

setBackground(k); t1=new TextField(100);

GridLayout gl=new GridLayout(4,5);

setLayout(gl); for(int i=0;i<10;i++){ b[i]=new Button(""+i); add=new Button("+"); sub=new Button("-"); mul=new Button("*"); div=new Button("/"); mod=new Button("%"); clear=new Button("clear");

EQ=new Button("=");

t1.addActionListener(this); add(t1); for(int i=0;i<10;i++) { add(b[i]); add(add); add(sub); add(mul); add(div); add(mod); add(clear); add(EQ); for(int i=0;i<10;i++) { b[i].addActionListener(this); add.addActionListener(this); sub.addActionListener(this); mul.addActionListener(this); div.addActionListener(this); mod.addActionListener(this); clear.addActionListener(this);

EQ.addActionListener(this);

public void actionPerformed(ActionEvent ae){ String str=ae.getActionCommand(); 1KNREDDYJAVA PROGRAMMING char ch=str.charAt(0); if (Character.isDigit(ch)) t1.setText(t1.getText()+str); else if(str.equals("+")) { v1=Integer.parseInt(t1.getText());

OP='+';

t1.setText(""); else if(str.equals("-")) { v1=Integer.parseInt(t1.getText());

OP='-';

t1.setText(""); else if(str.equals("*")) { v1=Integer.parseInt(t1.getText());

OP='*';

t1.setText(""); else if(str.equals("/")) { v1=Integer.parseInt(t1.getText());

OP='/';

t1.setText(""); else if(str.equals("%")){ v1=Integer.parseInt(t1.getText());

OP='%';

t1.setText(""); if(str.equals("=")){ v2=Integer.parseInt(t1.getText()); if(OP=='+') result=v1+v2; else if(OP=='-') result=v1-v2; else if(OP=='*') result=v1*v2; else if(OP=='/') result=v1/v2; else if(OP=='%') result=v1%v2; t1.setText(""+result); if(str.equals("clear")) { t1.setText("");

2KNREDDYJAVA PROGRAMMING

/*PROGRAM TO IMPLEMENT SIMPLE CALCULATOR USING SWING*/ import java.awt.*; import javax.swing.*; public class Calculator1 implements ActionListener{

JLabel jlab;

char OP;

JTextField t1;

int v1,v2; float result;

Calculator1( ) {

JButton b[]=new JButton[10];

JButton add,sub,mul,div,clear,mod,EQ;

JFrame jfrm = new JFrame("CALCULATOR");

jfrm.setSize(300, 180); jfrm.setLayout(new GridLayout(5,5)); t1=new JTextField(100); for(int i=0;i<10;i++) { b[i]=new JButton(""+i); add=new JButton("+"); sub=new JButton("-"); mul=new JButton("*"); div=new JButton("/"); mod=new JButton("%"); clear=new JButton("clear");

EQ=new JButton("=");

t1.addActionListener(this); for(int i=0;i<10;i++){ b[i].addActionListener(this); add.addActionListener(this); sub.addActionListener(this); mul.addActionListener(this); div.addActionListener(this); mod.addActionListener(this); clear.addActionListener(this);

EQ.addActionListener(this);

jfrm.add(t1); for(int i=0;i<10;i++) { jfrm.add(b[i]); jfrm.add(add); jfrm.add(sub); jfrm.add(mul); jfrm.add(div); jfrm.add(mod); jfrm.add(clear); jfrm.add(EQ); jfrm.setVisible(true); public void actionPerformed(ActionEvent ae) {

String str=ae.getActionCommand();

char ch=str.charAt(0); if (Character.isDigit(ch)) t1.setText(t1.getText()+str); 3KNREDDYJAVA PROGRAMMING else if(str.equals("+")) { v1=Integer.parseInt(t1.getText());

OP='+';

t1.setText(""); else if(str.equals("-")){ v1=Integer.parseInt(t1.getText());

OP='-';

t1.setText(""); else if(str.equals("*")) { v1=Integer.parseInt(t1.getText());

OP='*';

t1.setText(""); else if(str.equals("/")){ v1=Integer.parseInt(t1.getText());

OP='/';

t1.setText(""); else if(str.equals("%")){ v1=Integer.parseInt(t1.getText());

OP='%';

t1.setText(""); if(str.equals("=")){ v2=Integer.parseInt(t1.getText()); if(OP=='+') result=v1+v2; else if(OP=='-') result=v1-v2; else if(OP=='*') result=v1*v2; else if(OP=='/') result=(float)v1/v2; else if(OP=='%') result=v1%v2; t1.setText(""+result); if(str.equals("clear")) { t1.setText(""); public static void main(String[] args) {quotesdbs_dbs4.pdfusesText_7