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

Difference between while statement and a do while statement, What is the di...

What is the difference between a while statement and a do while statement? A while statement checks at the starting of a loop to see whether the next loop iteration should occu

Program for sorting algorithm - java program, Introduction: In this pr...

Introduction: In this project, you will explore a few sorting algorithms. You will also test their efficiency by both timing how long a given sorting operation takes and count

Name conflicts when importing packages, Name Conflicts when importing packa...

Name Conflicts when importing packages It is possible which you will try to import a package which contains classes in which have the similar name as a class in your own source

Need ios native app developer, Need iOS native App Developer Project Des...

Need iOS native App Developer Project Description: I want someone to help me prepare a simple inventory system. I am not a programmer trying to learn as i go. Skills re

Explain init(), Explain init(), start(), stop(), and destroy() method? ...

Explain init(), start(), stop(), and destroy() method? The init() method is known as exactly once in an applet's life, while the applet is first loaded. It's generally used to

Elaborate vector or object oriented graphics, Elaborate Vector or Object or...

Elaborate Vector or Object oriented graphics along with at least one example. Object Oriented Graphics are the graphics that are commonly oriented towards the objects and have

Palindrome, A palindrome is a string that reads the same from both the ends...

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

Test driven development (tdd)? , Test Driven Development (TDD) TDD pro...

Test Driven Development (TDD) TDD process gives your confidence in the delivered code for the following things. 1. TDD can remove duplication of code and also disciplines t

Write code in javascript language to show the odd numbers, Write code in Ja...

Write code in JavaScript language to show the odd numbers among 20 to 100 using FOR statement. Note: No requirement to write whole HTML program. Just JavaScript code of need p

Extensible messaging and presence protocol, According to XMPP Standards Fou...

According to XMPP Standards Foundation "XMPP is the Extensible Messaging and Presence Protocol, a set of open technologies for instant messaging, presence, multi-party chat, voice

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