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 7639875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T08:32:07+00:00 2026-05-31T08:32:07+00:00

I’m trying to create a new object using the parameters passed in, then use

  • 0

I’m trying to create a new object using the parameters passed in, then use that new object to place in the setCarColor method listed below. But my setCarColor in my constructor is giving an error for my clv variable. It says “Can not find symbol”. The clv is my variable from the CarColor class. I’m not sure if it is because the parameters being passed in(rdIn, grnIn, bluIn)are integers or what? Does anyone have any ideas please?

Best Regards,

public abstract class Vehicle 
{
  private String shapeId;
  CarColor carColor;//CarColor data member from the ColorValue.java class


public Shape(String bodyid, int rd, int grn, int ble)
{
 CarColor clv = new CarColor(rdIn, grnIn, bluIn);
 setCarColor(clv(rd, grn, ble));// <---error here
}

private CarColor getCarColor()
{
    return carColor;
}

private void setCarColor(int redIn, int blueIn, int greenIn)
{
if (redIn == 0 || blueIn == 0 || greenIn == 0 )
{
    System.out.println("The value entered in is null.  Please try again ");
    System.exit(-1);
}

}

  • 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-31T08:32:08+00:00Added an answer on May 31, 2026 at 8:32 am

    This line is nearly fine:

    ColorValue clv = new ColorValue(rdIn, grnIn, bluIn);
    

    … although it doesn’t populate the colorValue field, which is what you might have been expecting, and you don’t actually have rdIn, grnIn and bluIn variables. Did you mean rd, grn, ble? (It helps if you don’t contract names like this, by the way.)

    But this line is broken in two ways:

    setColorValue(clv(rd, grn, ble));
    

    Firstly, it’s trying to call a method called clv. You don’t have such a method. You’ve got a variable called clv, but you don’t “call” a variable.

    The second problem is that if you really meant this:

    setColorValue(clv);
    

    then you’d be using incorrect arguments – setColorValue doesn’t have one parameter of type ColorValue, it has three parameters, all ints.

    Unfortunately it’s not clear what you’re attempting to do, so it’s hard to advise you. Perhaps you mean this:

    public abstract class Geometry 
    {
        private String shapeId;
        private ColorValue colorValue;
    
        public Shape(String shapeId, int red, int green, int blue)
        {
            this.shapeId = shapeId;
            setColorValue(red, green, blue);
        }
    
        public ColorValue getColorValue()
        {
            return colorValue;
        }
    
        // Note the consistent order of the parameters - always red, green, blue.
        public void setColorValue(int red, int green, blue)
        {
            // Don't use System.exit() in the middle of a method! An exception
            // is the idiomatic way of reporting bad arguments.
            if (red == 0 || blue == 0 || green == 0)
            {
                throw new IllegalArgumentException("red green and blue must be non-zero");
            }
            colorValue = new ColorValue(red, green, blue);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create an if statement in PHP that prevents a single post
Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function

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.