import 'dart:io';//1 main(List<String>list) { print("Enter Two Numbers");//2varnumber1= double.parse(stdin.readLineSync());//3varnumber2 = double.parse(stdin.readLineSync());//4 print("Enter your choice\n A for Addition \n S for Subtraction \n M for Multiply \n D for Division");//5varuserchoice = stdin.readLineSync();//6varresult =" ";//7switch(userchoice)//8 {case "A":case "a": result ="Addition of$number1+$number2=${number1+number2}";//9break;case "S":case "s": result ="Subtraction of$number1-$number2=${number1-number2}";//10break;case "D":case "d": result ="Division of$number1/$number2=${number1/number2}";//11break;case "M":case "m": result ="Multiplication of$number1*$number2=${number1*number2}";//12break;default: result="Sorry! You Entered wrong choice";//13break; } print(result);//14 }

- import statement for input and out-stream lib for Dart
- Instruct to user enter two number
- Take user input and convert into double and assign to number1
- Take second user input and convert into double and assign to number2
- Instruct to the user for choosing their operator to perform calculations on numbers
- Assign your choice into userchoice variable
- Create result var with a blank string
- Apply switch case for userchoice
- if userchoice “A” or “a” then Addition is performed and assigned to result
- if userchoice “S” or “s” then subtraction is performed and assigned to result
- if userchoice “D” or “d” then Division is performed and assigned to result
- if userchoice “M” or “m” then Multiplication is performed and assigned to result
- if userchoice other than given choices then sorry massage assigned to result
- The calculation result is printed on Command prompt

Output

Enter Two Numbers

10

5

Enter your choice

A for Addition

S for Subtraction

M for Multiply

D for Division

A

Addition of 10.0+5.0=15.0

Enter Two Numbers

50

90

Enter your choice

A for Addition

S for Subtraction

M for Multiply

D for Division

S

Subtraction of 50.0-90.0=-40.0

Enter Two Numbers

67

5

Enter your choice

A for Addition

S for Subtraction

M for Multiply

D for Division

M

Multiplication of 67.0*5.0=335.0

Enter Two Numbers

56

7

Enter your choice

A for Addition

S for Subtraction

M for Multiply

D for Division

d

Division of 56.0/7.0=8.0

Enter Two Numbers

56

3

Enter your choice

A for Addition

S for Subtraction

M for Multiply

D for Division

p

Sorry! You Entered the wrong choice