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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T08:27:51+00:00 2026-06-07T08:27:51+00:00

Ok, So I’m hoping this should be quite a simple problem for someone out

  • 0

Ok,

So I’m hoping this should be quite a simple problem for someone out there.

The program works just fine, no errors, no crashes so thats a good start!

The problem is I’m getting an incorrect answer.

About half way down you should be able to see the line

CARV= CA*3; tv2.setText(Double.toString(CARV));

CA relates to num3, which is a user input. so if the user inputs 100 in editText2 it should print 300 to tv2. But instead it is giving me a random number, at the moment I’m assume it takes the additional calculations below the above line into account before printing the answer.

My question, is how do i print the answer to CA*3??

Many Thanks

private OnClickListener myClickListener = new OnClickListener()
{
    public void onClick(View v) {
        try{
        NS=Double.parseDouble(num1.getText().toString()); 
        CH=Double.parseDouble(num2.getText().toString());
        CA=Double.parseDouble(num3.getText().toString());
        Z=Double.parseDouble(num4.getText().toString());
        EKW=Double.parseDouble(num5.getText().toString());
        FAT=Double.parseDouble(num6.getText().toString());
        CART=Double.parseDouble(num7.getText().toString());
        GAT=Double.parseDouble(num8.getText().toString());}
        catch(Exception e)
        {
            if(num1.getText().length()==0)
            {
                num1.setError("please input ");
            }
            if(num2.getText().length()==0)
            {
                num2.setError("please input ");
            }
            if(num3.getText().length()==0)
            {
                num3.setError("please ");
            }
            if(num4.getText().length()==0)
            {
                num4.setError("please ");
            }
            if(num5.getText().length()==0)
            {
                num5.setError("please input ");
            }
            if(num6.getText().length()==0)
            {
                num6.setError("please input ");
            }
            if(num7.getText().length()==0)
            {
                num7.setError("please input ");
            }
            if(num8.getText().length()==0)
            {
                num8.setError("please input ");
            }

        }

        {SV=(((NS*CH)*4)/3600)/Z;SV=(double)(Math.round(SV*100))/100; tv1.setText(Double.toString(SV));
        CARV= CA*3; tv2.setText(Double.toString(CARV));
        FA= SV*0.1;
        GA= SV - (CARV + FA);
        RCARA= CARV/SV;
        RGA= GA/SV;
        RFA= FA/SV;
        CAO=(CARV*RCARA) + (GA*RGA) + (FA*RFA);
        DT= 26-CAO;
        RKW= DT * 1.21 * SV;RKW=(double)(Math.round(RKW*100))/100; tv3.setText(Double.toString(RKW));
        }

    }
};
    @Override
    public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.car1);

       tv1 = (TextView)findViewById(R.id.textView7);
       tv2 = (TextView)findViewById(R.id.textView8);
       tv3 = (TextView)findViewById(R.id.textView8);


       button01 = (Button)findViewById(R.id.button1);
       button01.setText("Display result");
       button01.setOnClickListener(myClickListener);

       num1 = (EditText)findViewById(R.id.EditText01);
       num1.setText("");
       num2 = (EditText)findViewById(R.id.editText1);
       num2.setText("");
       num3 = (EditText)findViewById(R.id.editText2);
       num3.setText("");
       num4 = (EditText)findViewById(R.id.editText3);
       num4.setText("");
       num5 = (EditText)findViewById(R.id.editText4);
       num5.setText("");
       num6 = (EditText)findViewById(R.id.editText5);
       num6.setText("-5");
       num7 = (EditText)findViewById(R.id.editText6);
       num7.setText("10");
       num8 = (EditText)findViewById(R.id.editText7);
       num8.setText("16");          
    }

}

  • 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-06-07T08:27:55+00:00Added an answer on June 7, 2026 at 8:27 am

    I think your problem is here

    tv2 = (TextView)findViewById(R.id.textView8);
    tv3 = (TextView)findViewById(R.id.textView8);
    

    You assign the same TextView to tv2 and tv3.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just tried to save a simple *.rtf file with some websites and
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am doing a simple coin flipping experiment for class that involves flipping a
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.