# Lesson 5 - Activity 1 - Can you use doubles and variables?

**URL:** <https://club.ministryoftesting.com/t/lesson-5-activity-1-can-you-use-doubles-and-variables/31702>\
**Category:** Discussions\
**Tags:** java-intro\
**Created:** [28 November 2019 15:47 UTC](https://club.ministryoftesting.com/t/lesson-5-activity-1-can-you-use-doubles-and-variables/31702 "2019-11-28T15:47:38Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike\_talks](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/mike_talks/32/11115_2.png) [@mike\_talks](https://club.ministryoftesting.com/u/mike_talks)\
**Post date:** [28 November 2019 15:47 UTC](https://club.ministryoftesting.com/t/lesson-5-activity-1-can-you-use-doubles-and-variables/31702/1 "2019-11-28T15:47:38Z")

</div>

**Time:** 15 minutes

**Purpose:** This activity helps you get familiar with using double number operators

**Introduction:** You’ve seen how to add two decimal numbers together - do you think you can try a few operations on your own?

**Task:** Perform the following operations on double variables and print the results,

1. Divide one integer by another
2. Subtract one integer from another
3. Multiply one integer by another

---

<div class="post-metadata">

**Author:** ![huib.schoots](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/huib.schoots/32/7014_2.png) [@huib.schoots](https://club.ministryoftesting.com/u/huib.schoots)\
**Post date:** [21 March 2020 17:19 UTC](https://club.ministryoftesting.com/t/lesson-5-activity-1-can-you-use-doubles-and-variables/31702/2 "2020-03-21T17:19:39Z")

</div>

```
    double decDivideTotal, devSubtractTotal, devMultiplyTotal;

    decDivideTotal = decNum1 / decNum2;
    devSubtractTotal = decNum1 - decNum2;
    devMultiplyTotal = decNum1 * decNum2;

    System.out.println("When we divide " + decNum1 + " by " + decNum2 + " we get: " + decDivideTotal);
    System.out.println("When we subtract " + decNum1 + " from " + decNum2 + " we get: " + devSubtractTotal);
    System.out.println("When we multiply " + decNum1 + " with " + decNum2 + " we get: " + devMultiplyTotal);
```

---

<div class="post-metadata">

**Author:** ![mike\_talks](https://sea2.discourse-cdn.com/flex020/user_avatar/club.ministryoftesting.com/mike_talks/32/11115_2.png) [@mike\_talks](https://club.ministryoftesting.com/u/mike_talks)\
**Post date:** [30 March 2020 03:18 UTC](https://club.ministryoftesting.com/t/lesson-5-activity-1-can-you-use-doubles-and-variables/31702/3 "2020-03-30T03:18:35Z")

</div>

Yay - that looks right!
