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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:09:46+00:00 2026-05-20T11:09:46+00:00

I have created an application for android that takes three inputs and makes a

  • 0

I have created an application for android that takes three inputs and makes a calculation

else {  
    float result1 = (((new Float(input11.getText().toString())
                     + new Float(input21.getText().toString()))/2));
    float result2 = (new Float(input31.getText().toString());
    if(result1<(result2 - 2)) {
       result1 = result2-2;
       float result=(float) ( (new Float(result1)*0.3)+(new Float(result2)*0.7));
       vprosvasis.setText(Float.toString(result));
    }
    else if(result1>(result2 + 2)) {
       result1=result2+2;
       float result=(float) ( (new Float(result1)*0.3)+(new Float(result2)*0.7));
       vprosvasis.setText(Float.toString(result));
    }
    else {
       float result = (float) ((((new Float(input11.getText().toString())
                                + new Float(input21.getText().toString()))/2)*0.3)
                                + (new Float(input31.getText().toString())*0.7));
       vprosvasis.setText(Float.toString(result));          
    }
}

Firstly,i would like the result in every statement to be e.x. 12.35 ,not 12,342323…
Secondly,i get in the same way vprosvasis2-vprosvasis7.i would like the final result that i print to be an integer and not a float..

float vprosvasisFloat = Float.parseFloat(vprosvasis.getText().toString());
float vprosvasisFloat2 = Float.parseFloat(vprosvasis2.getText().toString());
float vprosvasisFloat7 = Float.parseFloat(vprosvasis7.getText().toString());
float vprosvasisFloat5 = Float.parseFloat(vprosvasis6.getText().toString());
float vprosvasisFloat4 = Float.parseFloat(vprosvasis7.getText().toString());
float vprosvasisFloat3 = Float.parseFloat(vprosvasis6.getText().toString());
float vprosvasisFloat6 = Float.parseFloat(vprosvasis5.getText().toString());
float genikosvathmosoik = (( new Float(vprosvasis.getText().toString())
               + new Float(vprosvasis2.getText().toString())
               + new Float(vprosvasis3.getText().toString())
               + new Float(vprosvasis4.getText().toString())
               + new Float(vprosvasis5.getText().toString())
               + new Float(vprosvasis6.getText().toString())
                           + new Float(vprosvasis7.getText().toString())) / 7);

moria2oik = (((new Float ((genikosvathmosoik*8)+(vprosvasisFloat * 1.3)+(vprosvasisFloat2 * 0.7))*100)));     
moria3oik=(((new Float ((genikosvathmosoik*8)+(vprosvasisFloat4 * 1.3)+(vprosvasisFloat3 * 0.7))*100)));      
moria5oik=(((new Float ((genikosvathmosoik*8)+(vprosvasisFloat7 *1.3)+(vprosvasisFloat6 * 0.7))*100)));
switch(spinner.getSelectedItemPosition()){
    case 0:
        show = new AlertDialog.Builder(mContext).setTitle(R.string.app_name)
                              .setMessage("1o :  -\n2o :  "
                                         + moria2oik + "\n3o :  " 
                                         + moria3oik + "\n4o :  " 
                                         + moria2oik + "\n5o :  "
                                         + moria5oik)
                              .setPositiveButton("OK", null).show();
    break;
  • 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-20T11:09:46+00:00Added an answer on May 20, 2026 at 11:09 am

    If I understand the question correctly, you should look into the Math class of Java. Here is the developer doc.

    The math class can do almost everything when it comes to manipulating a float or double.

    The other class you might want to look at is DecimalFormat which can do exactly what is says, format decimals. 🙂 That is available here.

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

Sidebar

Related Questions

I have created an application for Android that has an activity that has a
friends, i want to delete file data that i have created in android application.
I have created android application that uses Google Maps, ans it works fine here
i have created one android application that was connecting to sqlite database. and i
I have created an application that writes some data to the root folder of
I have created an application that runs in the taskbar. When a user clicks
I have created an application that has a toolbar, menubar and content area. I
I have created an application that uses settings.settings to store some user specific settings
I have created a webview application to run a web application on an android
I am developing an android application in which i have created five tabs and

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.