cp and sp

cp and sp

design a gui application to accept the cost price and selling price from the user in two textfields and then calculate the profit or loss occured

View Answers

August 2, 2011 at 5:39 PM

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

class  FindProfitOrLoss{
    public static void main(String[] args){
    Frame f=new Frame();
    Label label1=new Label("Enter CP: ");
    Label label2=new Label("Enter SP: ");
    final TextField text1=new TextField(20);
    final TextField text2=new TextField(20);
    Button b=new Button("Find");
    b.addActionListener(new ActionListener(){
        public void actionPerformed(ActionEvent e){
        int cp=Integer.parseInt(text1.getText());
        int sp=Integer.parseInt(text2.getText());
        if(cp>sp){
            int loss=cp-sp;
            JOptionPane.showMessageDialog(null,"There is a loss of "+loss+" rupees");
        }
        if(sp>cp){
            int profit=sp-cp;
            JOptionPane.showMessageDialog(null,"There is a profit of "+profit+" rupees");
        }
        }
        });
        Panel p=new Panel(new GridLayout(3,2));
        p.add(label1);
        p.add(text1);
        p.add(label2);
        p.add(text2);
        p.add(b);
        f.add(p);
        f.setVisible(true);
        f.pack();
    }
}









Related Tutorials/Questions & Answers:
cp and sp
cp and sp  design a gui application to accept the cost price and selling price from the user in two textfields and then calculate the profit or loss occured
ModuleNotFoundError: No module named 'sp'
ModuleNotFoundError: No module named 'sp'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sp' How to remove the ModuleNotFoundError: No module named 'sp' error
Advertisements
Version of com.immibytes>sp-utils dependency
List of Version of com.immibytes>sp-utils dependency
sp data science
sp data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: sp data science Try... "sp data science". Also tell me which is the good training courses
sp jain machine learning
sp jain machine learning  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: sp jain... learn the topic "sp jain machine learning". Also tell me which
ModuleNotFoundError: No module named 'mysql-sp'
ModuleNotFoundError: No module named 'mysql-sp'  Hi, My Python... 'mysql-sp' How to remove the ModuleNotFoundError: No module named 'mysql-sp... to install padas library. You can install mysql-sp python with following
ModuleNotFoundError: No module named 'sp-ccrawl'
ModuleNotFoundError: No module named 'sp-ccrawl'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sp-ccrawl' How to remove the ModuleNotFoundError: No module named 'sp
ModuleNotFoundError: No module named 'sp-licitacoesPy'
ModuleNotFoundError: No module named 'sp-licitacoesPy'  Hi, My... named 'sp-licitacoesPy' How to remove the ModuleNotFoundError: No module named 'sp-licitacoesPy' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'sp_python'
ModuleNotFoundError: No module named 'sp_python'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sp_python' How to remove the ModuleNotFoundError: No module named 'sp
ModuleNotFoundError: No module named 'django-sp'
ModuleNotFoundError: No module named 'django-sp'  Hi, My Python... 'django-sp' How to remove the ModuleNotFoundError: No module named 'django-sp' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'django-sp'
ModuleNotFoundError: No module named 'django-sp'  Hi, My Python... 'django-sp' How to remove the ModuleNotFoundError: No module named 'django-sp' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'sp-ccrawl'
ModuleNotFoundError: No module named 'sp-ccrawl'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sp-ccrawl' How to remove the ModuleNotFoundError: No module named 'sp
ModuleNotFoundError: No module named 'sp-games'
ModuleNotFoundError: No module named 'sp-games'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sp-games' How to remove the ModuleNotFoundError: No module named 'sp-games
ModuleNotFoundError: No module named 'sp-health'
ModuleNotFoundError: No module named 'sp-health'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sp-health' How to remove the ModuleNotFoundError: No module named 'sp
ModuleNotFoundError: No module named 'sp-mysql'
ModuleNotFoundError: No module named 'sp-mysql'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sp-mysql' How to remove the ModuleNotFoundError: No module named 'sp-mysql
ModuleNotFoundError: No module named 'sp_python'
ModuleNotFoundError: No module named 'sp_python'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sp_python' How to remove the ModuleNotFoundError: No module named 'sp
ModuleNotFoundError: No module named 'sp-utils'
ModuleNotFoundError: No module named 'sp-utils'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'sp-utils' How to remove the ModuleNotFoundError: No module named 'sp-utils
ModuleNotFoundError: No module named 'django-lastpass-sp'
ModuleNotFoundError: No module named 'django-lastpass-sp'  Hi, My... named 'django-lastpass-sp' How to remove the ModuleNotFoundError: No module named 'django-lastpass-sp' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-saml-sp'
ModuleNotFoundError: No module named 'django-saml-sp'  Hi, My... named 'django-saml-sp' How to remove the ModuleNotFoundError: No module named 'django-saml-sp' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'sp-ask-chats-utils'
ModuleNotFoundError: No module named 'sp-ask-chats-utils'  Hi, My... named 'sp-ask-chats-utils' How to remove the ModuleNotFoundError: No module named 'sp-ask-chats-utils' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'django-saml-sp'
ModuleNotFoundError: No module named 'django-saml-sp'  Hi, My... named 'django-saml-sp' How to remove the ModuleNotFoundError: No module named 'django-saml-sp' error? Thanks   Hi, In your python
WEBLOGIC8.1 SP 6 - JSP-Servlet
WEBLOGIC8.1 SP 6   SIR, I am new to jsp and weblogic8.1 and developing project on jsp use of oracle9i.My doubt is how to use RowSet and retrive the values using RowSet,displaying that in a text box based on the data
Maven Dependency sp-utils >> 1.0.0-RELEASE
You should include the dependency code given in this page to add Maven Dependency of com.immibytes >> sp-utils version1.0.0-RELEASE in your project
ModuleNotFoundError: No module named 'cp'
ModuleNotFoundError: No module named 'cp'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'cp' How to remove the ModuleNotFoundError: No module named 'cp' error
ModuleNotFoundError: No module named 'cp'
ModuleNotFoundError: No module named 'cp'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'cp' How to remove the ModuleNotFoundError: No module named 'cp' error
ModuleNotFoundError: No module named 'cp'
ModuleNotFoundError: No module named 'cp'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'cp' How to remove the ModuleNotFoundError: No module named 'cp' error
Maven Repository/Dependency: com.immibytes | sp-utils
Maven Repository/Dependency of Group ID com.immibytes and Artifact ID sp-utils. Latest version of com.immibytes:sp-utils dependencies. # Version Release Date You can read more
ModuleNotFoundError: No module named 'cp-es'
ModuleNotFoundError: No module named 'cp-es'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'cp-es' How to remove the ModuleNotFoundError: No module named 'cp-es'
ModuleNotFoundError: No module named 'cp-redis'
ModuleNotFoundError: No module named 'cp-redis'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'cp-redis' How to remove the ModuleNotFoundError: No module named 'cp-redis
ModuleNotFoundError: No module named 'cp-redis'
ModuleNotFoundError: No module named 'cp-redis'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'cp-redis' How to remove the ModuleNotFoundError: No module named 'cp-redis
ModuleNotFoundError: No module named 'cp_sqlalchemy'
ModuleNotFoundError: No module named 'cp_sqlalchemy'  Hi, My... 'cp_sqlalchemy' How to remove the ModuleNotFoundError: No module named 'cp_sqlalchemy' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cp_sqlalchemy'
ModuleNotFoundError: No module named 'cp_sqlalchemy'  Hi, My... 'cp_sqlalchemy' How to remove the ModuleNotFoundError: No module named 'cp_sqlalchemy' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cp_sqlalchemy'
ModuleNotFoundError: No module named 'cp_sqlalchemy'  Hi, My... 'cp_sqlalchemy' How to remove the ModuleNotFoundError: No module named 'cp_sqlalchemy' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'rds-cp'
ModuleNotFoundError: No module named 'rds-cp'  Hi, My Python...-cp' How to remove the ModuleNotFoundError: No module named 'rds-cp'... to install padas library. You can install rds-cp python with following command
ModuleNotFoundError: No module named 'rds-cp'
ModuleNotFoundError: No module named 'rds-cp'  Hi, My Python...-cp' How to remove the ModuleNotFoundError: No module named 'rds-cp'... to install padas library. You can install rds-cp python with following command
ModuleNotFoundError: No module named 'sam-cp'
ModuleNotFoundError: No module named 'sam-cp'  Hi, My Python...-cp' How to remove the ModuleNotFoundError: No module named 'sam-cp'... to install padas library. You can install sam-cp python with following command
ModuleNotFoundError: No module named 'sam-cp'
ModuleNotFoundError: No module named 'sam-cp'  Hi, My Python...-cp' How to remove the ModuleNotFoundError: No module named 'sam-cp'... to install padas library. You can install sam-cp python with following command
ModuleNotFoundError: No module named 'scikit-CP'
ModuleNotFoundError: No module named 'scikit-CP'  Hi, My Python... 'scikit-CP' How to remove the ModuleNotFoundError: No module named 'scikit-CP' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'atlas-cp'
ModuleNotFoundError: No module named 'atlas-cp'  Hi, My Python... 'atlas-cp' How to remove the ModuleNotFoundError: No module named 'atlas-cp... to install padas library. You can install atlas-cp python with following
ModuleNotFoundError: No module named 'cp-es'
ModuleNotFoundError: No module named 'cp-es'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'cp-es' How to remove the ModuleNotFoundError: No module named 'cp-es'
ModuleNotFoundError: No module named 'cp-music'
ModuleNotFoundError: No module named 'cp-music'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'cp-music' How to remove the ModuleNotFoundError: No module named 'cp-music
ModuleNotFoundError: No module named 'cp-redis'
ModuleNotFoundError: No module named 'cp-redis'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'cp-redis' How to remove the ModuleNotFoundError: No module named 'cp-redis
ModuleNotFoundError: No module named 'cp_sqlalchemy'
ModuleNotFoundError: No module named 'cp_sqlalchemy'  Hi, My... 'cp_sqlalchemy' How to remove the ModuleNotFoundError: No module named 'cp_sqlalchemy' error? Thanks   Hi, In your python
ModuleNotFoundError: No module named 'cp-tools'
ModuleNotFoundError: No module named 'cp-tools'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'cp-tools' How to remove the ModuleNotFoundError: No module named 'cp-tools
ModuleNotFoundError: No module named 'sp-ask-running-total-daily-report'
ModuleNotFoundError: No module named 'sp-ask-running-total-daily-report' ...: ModuleNotFoundError: No module named 'sp-ask-running-total-daily-report' How to remove the ModuleNotFoundError: No module named 'sp-ask-running-total-daily-report'
ModuleNotFoundError: No module named 'sp-ask-report-chats-per-school'
ModuleNotFoundError: No module named 'sp-ask-report-chats-per-school' ...: No module named 'sp-ask-report-chats-per-school' How to remove the ModuleNotFoundError: No module named 'sp-ask-report-chats-per-school' error
Version of com.appslandia>appslandia-common-cp dependency
List of Version of com.appslandia>appslandia-common-cp dependency
ModuleNotFoundError: No module named 'cloudshell-cp-aws'
ModuleNotFoundError: No module named 'cloudshell-cp-aws'  Hi, My... named 'cloudshell-cp-aws' How to remove the ModuleNotFoundError: No module named 'cloudshell-cp-aws' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'cloudshell-cp-core'
ModuleNotFoundError: No module named 'cloudshell-cp-core'  Hi, My... named 'cloudshell-cp-core' How to remove the ModuleNotFoundError: No module named 'cloudshell-cp-core' error? Thanks   Hi, In your
ModuleNotFoundError: No module named 'cloudshell-cp-docker'
ModuleNotFoundError: No module named 'cloudshell-cp-docker'  Hi...: No module named 'cloudshell-cp-docker' How to remove the ModuleNotFoundError: No module named 'cloudshell-cp-docker' error? Thanks   Hi

Ads