Write a program to add of doubles in java, JAVA Programming

Assignment Help:

Write a program to add of doubles in java?

Doubles are treated much the similar way, but now you obtain to use decimal points in the numbers. This is a same program which does addition and subtraction on doubles.

class AddDoubles {
   public static void main (String args[]) {
     double x = 7.5;
    double y = 5.4; 
     System.out.println("x is " + x);
    System.out.println("y is " + y);
      double z = x + y;
    System.out.println("x + y is " + z);
        z = x - y;
    System.out.println("x - y is " + z);
   }
  } 

Here's the result:

% javac AddDoubles.java
% java AddDoubles
x is 7.5
y is 5.4
x + y is 12.9
x - y is 2.0999999999999996

Related Discussions:- Write a program to add of doubles in java

Create an application for Koch’s Cottages, Create an application for Koch’s...

Create an application for Koch’s Cottages, a weekend getaway resort that rents cottages and boats to use on the local lakenimum 100 words accepted#

Application to control robot arm , I send you these files in order to make ...

I send you these files in order to make clear image about my task that I want you to design for me an application for PC that used to control robot arm via micro controller PIC18.

What are checked and unchecked exception, What are Checked and UnChecked Ex...

What are Checked and UnChecked Exception? A checked exception is some subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses. Making a

Explain what is constructors, Explain what is constructors ? It is freq...

Explain what is constructors ? It is frequent the case in which overloaded techniques are essentially the similar except that one supplies default values for a few of the argum

Program to read a keyboard value and exit from the code, Using the above t...

Using the above thread program, now create 20 threads in your program and run them. No need to wait for the keyboard in each thread, just print "Hello" and its thread id in each t

Describe the benefits of threads, Question 1: a) What is an "Operating...

Question 1: a) What is an "Operating System"? b) Describe the four main computer system components. c) Describe and compare "Parallel Systems" and "Distributed Systems

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd