I need to extend my work in lab 2 that’s going to be a calculator that has two modes. A programmer mode that will accept any unsigned decimal number and convert it to binary with no leading zeros along with a error print statement if the integer is not positive. Then in Scientific mode the user will choose between different mathematical operations, +,-,/,*,** and be prompted for two operands following the operator. That part I’m confused about does it mean lets says you choose + then the two operands after are 2 and 3 so it’s “+ 2 3”? I’m sure it just means “2 + 3” it’s just worded a little confusing. But after it does the calculation it needs to ask the user what they want to do. 1 do another calculation, 2 go to a different mode, 3 exit after the calculation.
• Devise a plan
First I’m going to focus on the programmer side for the calculator as I think it’ll be easier. Then after I finish it all I’ll start the bare bones of the scientific calculator. Then for the programmer I’m going to work on the end condition in which after the program runs successful to see if it’ll do another calculation then see if it’ll go to scientific mode and then exit. After that works successfully I’ll finish off the scientific side of the calculator and make sure the end condition works for it as well.
• Carry out the plan
On the py file
• Looking back
Test case if the user inputs a negative number it should print an error message. It does
Test case if the user puts 1 for the decimal number it should print 1 for the binary number. It does
Test case for recursion, it should continue asking for integers to calculate until you enter 3. It does.
Looking back figuring out the recursion with while loops without getting infinite loops was tough.