Honest Calculator. Stage 2/5

First calculations

Report a typo

Description

In this stage, we will continue with the flowchart. Note that the blocks from the previous stage are in red. Be careful; some flows can work differently.

block diagram of the Honest Calculator

Objectives

Implement the flowchart above. While doing it, please, follow our recommendations:

  • Don't use the built-in functions to calculate from a string;
  • The result variable must be of the float type;
  • Copy the message. The tests will check if the correct message appears in the correct order. So don't add extra lines or characters: msg_3 = "Yeah... division by zero. Smart move..."

Examples

The greater-than symbol followed by a space (> ) represents the user input. Note that it's not part of the input.

Example 1:

Enter an equation
> 2 + m
Do you even know what numbers are? Stay focused!
Enter an equation
> 3 n 3
Yes ... an interesting math operation. You've slept through all classes, haven't you?
Enter an equation
> 4 / 0
Yeah... division by zero. Smart move...
Enter an equation
> 4 * 5.2
20.8

Example 2:

Enter an equation
> 411 - 211
200.0
Write a program
# Write your code here

___

Create a free account to access the full topic