Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7703393
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:26:55+00:00 2026-05-31T23:26:55+00:00

I’m not sure what’s going on here but here’s a section I’m having problems

  • 0

I’m not sure what’s going on here but here’s a section I’m having problems with (there’s a few others but I think if I can figure out the logic here I can apply it elsewhere).

I recently had a problem where I was using point but couldn’t get decimals so, as suggested, I switched to point2D to allow for doubles. Since switching I have been getting errors that I can’t seem to understand how to fix because I don’t see the cause (I know changing to point2D triggered it but I can’t see the connection).

I have the following code:

Double x_data = (Double) data.get(k); 
for (int c = 0; c <= 100; c++) { //the c variable caps the percent
    double percent = roundTwoDecimals(c*.01);
    double value1 =(sum - percent * x_data);

data is a list of point2D(which I’m casting to to double and sum is a variable I send in to this method that is really an integer but I cast it as a double. In eclipse I get the dreaded red underline under ‘percent * x_data’. I googled and saw this error is often caused by someone trying to multiply a string or something but I’m fairly certain these all doubles. I get the following error now:

Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
    The operator * is undefined for the argument type(s) double, Point2D.Double
    The operator * is undefined for the argument type(s) double, Point2D.Double
    Syntax error, insert ")" to complete ArgumentList
    The operator * is undefined for the argument type(s) double, Point2D.Double

As far as I can tell everything involved in this process is either double or casted to double so I’m not sure why Point2D is involved in these operators.

Also I had a method that limited decimal places:

static double roundTwoDecimals(double d) {
        DecimalFormat twoDForm = new DecimalFormat("#.###");
        return Double.valueOf(twoDForm.format(d));

but Double.valueOf is not one of the options anymore so I got errors (Point2D errors) on that(to get around it, I just return d back right now without limiting the decimals).

I don’t think there is a problem with point2D or anything but I must be structurally doing something wrong.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:26:56+00:00Added an answer on May 31, 2026 at 11:26 pm

    According to the stack trace, x_data is of type Point2D.Double, not java.lang.Double.
    Check your imports, remove Point2D.Double and add java.lang.Double.

    Now you won’t be able to cast a Point2D to a Double. You probably mean to use yourDoublePoint2D.getX() adn yourDoublePoint2D.getY() which return doubles (no cast required).

    As a side note, you can write something like this:

    Double d1 = 1.5;
    double d2 = 2.3;
    double d3 = d1 * d2;
    

    EDIT
    You are likely importing Point2D.Double class with this:

    import java.awt.geom.Point2D.*;
    

    or

    import java.awt.geom.Point2D.Double;
    

    That creates a name collision with java.lang.Double. See below an example of code that would work as you expect:

    import java.awt.geom.Point2D; //Note: only import Point2D, not Point2D.Double
    
    public class Test {
    
        public static void main(String[] args) {
            Point2D.Double point = new Point2D.Double(1.5, 2.5);
            double x = point.getX(); //1.5
            double y = point.getY(); //2.5
            Double xx = point.getX(); //1.5
            Double yy = point.getY(); //2.5
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
Seemingly simple, but I cannot find anything relevant on the web. What is the
I have a French site that I want to parse, but am running into
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.