Hi! I am currently making a program that draws a variety of graphs, and I’ve finished with the bar graph and line graph. They work well, and I am trying to add another function: a pie graph.

I am making the drawing part first before I put it together with the entire code, but it does not work well. I think there is a problem with the dividing part. However, I cannot find out the problem. I saved the results as a float variable just in case int can not hold the answer, but it still always ends up with 0. Can someone help me find the problem? The code is below. I boldened the part that causes the problem.

```
import javax.swing.JOptionPane;
PFont f;
void setup()
{
background(0);
size(2000, 4000);
textSize(30);
arr = new IntList();
deg = new IntList();
arr.append(8);
arr.append(9);
arr.append(6);
arr.append(8);
arr.append(9);
arr.append(6);
arr.append(6);
num=7;
//title =
title = "dss";
}
int num=0;
String title = "Untitled #1";
IntList arr;
IntList deg;
int a = 0;
void draw()
{
int hap = 0;//Is the sum(hap means sum in Korean:))
for(int i = 0; i < num; i++){
hap += arr.get(i);
}
//////////////////////////////////////////////////////////////problem part starts//////////////////////////////////////////////////////////////////////
float a;
for(int i = 0; i < num; i++){
a = arr.get(i) / hap;
deg.append((int)a * 360);
println(i+"- a : "+a);
println(i+" : "+deg.get(i));
}
//////////////////problem part ends////////////////////////////
println("hap ="+hap);
int before = deg.get(0);
arc(350, 350, 380, 380, radians(0), radians(deg.get(0)));
for(int i = 1; i < num; i++){
fill(i*107%255, i*61%255, i*162%255);
arc(350, 350, 380, 380, radians(before), radians(deg.get(i)));
before = deg.get(i);
}
}
```