Question: Modify this calculator class using a while loop. The loop asks the user if he or she wants to perform an operation. If the answer
Modify this calculator class using a while loop. The loop asks the user if he or she wants to perform an operation. If the answer is yes, the program promotes the user to select operation, and then performs the calculation. It then proceeds with the next iteration of the loop, which asks the user again if he or she wants to perform an operation. If the answer is anything but "yes ", the loop(and the program ) terminates. import java.util. class Cakulator Main method public statie void main Stringll args) Creating a scanner class ebjcct Syilemout-PrintIn("a The calculabr supports the following operatices: i1+ 'in-nn / Rcading eperation from user String operator reader mextLineO double operl, eper2, result-00, Rwla SIN n WReading operand 1 System oupri n Enter operand : oper reader.nextDoublo) WReading operand 2 Syslemoupris n Enter operand 2: oper2 reader.nextDouhlo operator aquak" +") result- operl+oper2 else ifloperator.cquals result- operI - oper2 ese ifloperator.cquals result- oper eper2, Divisn operation else iffoperator.equals Division operation result- operl oper Power operation Division opcration Printing resuh
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
