import java.awt.*;
import java.applet.*;
// This program calculates the total and average of four
// sums of money
// The total should be 7288.76
// the average should 1822.19
public class Q3 extends Applet
{
int counter;
double totalMoney;
double myMoney, yourMoney, theirMoney, ourMoney;
int averageMoney;
public void paint(Graphics g)
{
counter=0;
totalMoney=myMoney+yourMoney+theirMoney+ourMoney;
mayMoney == 55.99;
yourMoney = 22.55;
theirMoney = 666.88;
ourMoney = 6543.34;
averageMoney=(int)totalMoney/counter;
g.drawString("total money = " + totalMoney, 20, 50);
g.drawString("average money = " + averageMoney, 20, 50);
}
}
|