Boolean and making titles

So I need help for my homework, but for these steps I don’t understand what I am doing wrong and how to fix it. These functions are meant to get the information of the earthquakes and draw a popup with the indicated information when the mouse is over the circle.

boolean overCircle(int x, int y) {
  if (mouseX >= x+5 && mouseX <= x-5 && mouseY >= y+5 && mouseY <=y-5)
 return true; // always return true for now
This function draws a popup rectangle containing the
title information of the given earthquake data.

 - JSONObject datum: data on one earthquake
 - int x, int y: the location of the earthquake
returns void
void drawPopup(JSONObject datum, int x, int y) {
  // TODO (HW problem 3) write your code here.  
  // Delete this comment when you are finished.
 if  {boolean
   returns true 
1 Like

Please don’t post the code as an image, post it as text

The command return leaves the function. Do you want this?

The function getTitle() should return a String, presumably from the Json? That’s what the title of the function getTitle suggests!

Anyway. The function drawPopup() should

  • draw a rect (what you have in getTitle() now) and
  • some text - use fill() and text().
  • See reference for those.


1 Like