What's new

Closed Patulong po dito sa applet coding ko di po kasi mag divide

Status
Not open for further replies.

euls020

Addict
Joined
Jan 30, 2016
Posts
221
Reaction
37
Points
123
Patulong po dito sa applet coding ko di po kasi mag divide. ty po. ayaw po gumawa yung divide 4 may mali po ba dito. ang nalabas kase sa halip na 91 nagiging 295. di ko po alam kung bakit kung hindi naman po nagana yung divide dapat 364 po sagot. ano po ba mali.

public void actionPerformed(ActionEvent objEvent){
int ave=0;
if(objEvent.getSource()==cmdCalculate)
{
ave=Integer.parseInt(txtProgramming.getText())+Integer.parseInt(txtDatabase.getText())+Integer.parseInt(txtPhilosophy.getText())+Integer.parseInt(txtLiterature.getText())/4;
txtGeneralAverage.setText(String.valueOf(ave));
 
Last edited:
nagawa ko na sir. salamat po sa tulong. medyo pinahaba ko lang po tas tumama sir. salamat.
public void actionPerformed(ActionEvent objEvent){
int total=0;
if(objEvent.getSource()==cmdCalculate)
{
int num1 = Integer.parseInt(txtProgramming.getText());
int num2 = Integer.parseInt(txtDatabase.getText());
int num3 = Integer.parseInt(txtPhilosophy.getText());
int num4 = Integer.parseInt(txtLiterature.getText());

int answer= num1 + num2 + num3 + num4;
total= answer/4;
txtGeneralAverage.setText(String.valueOf(total));
}
}
}
 
Status
Not open for further replies.
Back
Top