Gallery
Solution Calculations
Share
Explore
Solution Calculations

icon picker
The Task

Activity: Calculations 🧮

A bug report has been submitted on this program. The program is incomplete. So far the program asks for two numbers and adds them together and displays this as an output. Hoewever, looking at the design below you can see that the program should also calculate and display results for subtracting, multiplying and dividing.

Start Here

Work individually explore the program and edit the code so that it produces all the required output results.
Update to the program to also calculate and display results for subtracting, multiplying and dividing using the same two numbers.

design

steps: 1, 2, 3, 4, 5 and 9 are coded
steps: 6, 7, 8, 10, 11, 12 are missing from the code
prompt for first number
get numberOne from keyboard
prompt for second number
get numberTwo from keyboard
set additionAnswer to numberOne add numberTwo
set subtractionAnswer to numberOne minus numberTwo
set multiplyAnswer to numberOne multiplied by numberTwo
set divisionAnswer to numberOne divided by numberTwo
display message with numberOne, numberTwo and additionAnswer
display message with numberOne, numberTwo and subtractionAnswer
display message with numberOne, numberTwo and multiplyAnswer
display message with numberOne, numberTwo and divisionAnswer

sample output

Enter the first number: 45
Enter the second number: 32

45 + 32 = 77
45 - 32 = 13
45 * 32 = 1440
45 / 32 = 1
45/32 is 1 because it means 1 (remainder 13)
this kind of dividing does not produce decimal fractions
Good luck! 🍀
Share
 
Want to print your doc?
This is not the way.
Try clicking the ⋯ next to your doc name or using a keyboard shortcut (
CtrlP
) instead.