Sum of multiple checkbox values in a textbox
Sum of multiple checkbox values in a textbox. Get complete coding of java program to show sum of multiple checkbox checked value and get their sum in a textbox. In this you will also know that how we can change the result of string data type into integer data type and get sum in textbox.
Here you can also find that how to sum multiple checkbox data and change a string data type into an integer data type and get their results into integer data type.
You would also like to visit:
- Create Calculator through java programming|Complete Coding
- How to connect java with database|Using JDBC-ODBC Connection string
- How to Create combo box in java|Complete Coding
- Java program to calculate Age from Date of birth
- How to Create combo box in java|Complete Coding
- Employee Registration form | Creation of Registration form in visual studio using c# and asp.net
- How to create a Recruitment or job announcement page in asp.net | Complete front end designing and backend coding
- How add new webpage in a website using C#, asp.net in visual studio.
- How to create login page using asp.net and C#
pepsichk=new Checkbox(“pepsi=50”);
pepsichk.setBounds(20,80,100,25);
saladchk=new Checkbox(“salad=100”);
saladchk.setBounds(20,110,100,25);
totallb=new Label(“total”);
totallb.setBounds(10,160,100,25);
totaltxt=new TextField(30);
totaltxt.setBounds(120,160,100,25);
calbt=new Button(“calculate”);
calbt.setBounds(30,200,100,25);
calbt.addActionListener(this);
add(pizzachk);
add(pepsichk);
add(saladchk);
add(totallb);
add(totaltxt);
add(calbt);
setVisible(true);
}
public void actionPerformed(ActionEvent ae)
{
int total=0;
String str=””;
if(ae.getSource()==calbt)
{
if(pizzachk.getState())
total=total+500;
if(saladchk.getState())
total=total+100;
totaltxt.setText(str.valueOf(total));
}
}
}
class fast
{
public static void main(String str[])
{
pizzaframe f=new pizzaframe();
}
}