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

Explain the difference between hash map and hash table, Difference between ...

Difference between Hash Map and Hash Table? The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and allows nulls. (HashMap allows null values

Develop an ehospital project, Develop an ehospital project Project Descr...

Develop an ehospital project Project Description: I am preparing ehopsital project.for the requires of hospital in that patient registration and billing module and stores mod

Demonstrate a minimal server and client program, This exercise will give yo...

This exercise will give you some introductory exposure to network programming with sockets. Your task is to demonstrate a minimal server program and client program that can send on

#, Consider the following code? What input is needed for x in order for the...

Consider the following code? What input is needed for x in order for the sum variable that is output at the end of the code to be 12 ? (In other words: what do I need to make X be

What is action class, The Action Class is type of the Model and is a wrappe...

The Action Class is type of the Model and is a wrapper around the business logic. The purpose of Action Class is to change the HttpServletRequest to the business logic. To use the

Describe exception classes, Java Programming 1. Discuss any five buzz w...

Java Programming 1. Discuss any five buzz words in Java. 2. Describe exception classes and also explain common exceptions in java. 3. Describe primitive and abstract data

Explain bios in java language, Explain BIOS in java language? BIOS bas...

Explain BIOS in java language? BIOS basically stand for Basic input/output system it is also called as the system BIOS or ROM BIOS is a de facto standard describing a firmware

How to creating arrays in java, How to Creating Arrays in java? Declari...

How to Creating Arrays in java? Declaring arrays merely says what type of values the array will hold. It does not form them. Java arrays are objects, and such as any other obje

Exportobject of unicastremoteobject do, What does the exportObject of Unica...

What does the exportObject of UnicastRemoteObject do? Ans) Exports the remote object to make it available to receive incoming calls, using the certain supplied port. If port not

Which is better to store data as attributes or as elements? , A question ri...

A question rising in the mind of XML/DTD designers is whether to model and encode retain information using an attribute, or alternatively, using an element. 1. Using  an  elemen

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