Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a computer application called \"calculator\" with the following requireme

ID: 3764326 • Letter: D

Question

Design a computer application called "calculator" with the following requirements:

The application has a main function, which displays a typical calculator interface, plus a "Quit" button. When the appstarts, it goes into an infinite loop, which can only be terminated by clicking on the Quit button.

By clicking on the appropriate buttons, the user can:

enter the first value, which will be checked to ensure the value is numeric (you need only be concerned with integers at this time)

select the operand (+,-,*,/,%) by clicking the appropriate button

enter the second value

select the equals (=) button to display the results

The application will have separate, and self-contained functions for addition, subtraction, multiplication, division, and the modulus. The appropriate function will be called based on the user's operand selection, and will receive the values it will calculate via two parameters.

The division and modulus functions will verify that the divisor is not zero, and not perform a calculation if it is.

Each function will return its results in a string.

The appropriate calling function, having received its return value, will place it in a display box.

Your deliverables will be:

Flowcharts which sufficiently document the application

Pseudo-code, which provides a step by step set of code like instructions sufficient to carry out the application's tasks.

Explanation / Answer

pesudo code:

code:

#include<stdio.h>
#include<math.h>
int add(int, int);
int sub(int, int);
int mul(int, int);
float dib(float, float);

int main(){
int operand1, operand2, choice;

printf("1:addiction 2:substraction 3:multiplication 4:division 0:exit please enter your choice:");
scanf("%d", &choice);

switch(choice){
case 0:
return 0;
break;
case 1:
printf("Enter 1st number: ");
scanf("%d", &operand1);
printf("Enter 2nd number: ");
scanf("%d", &operand2);
printf("%d", add(operand1,operand2));
break;
case 2:
printf("Enter 1st number: ");
scanf("%d", &operand1);
printf("Enter 2nd number: ");
scanf("%d", &operand2);
printf("%d ", sub(operand1,operand2));
break;
case 3:
printf("Enter 1st number: ");
scanf("%d", &operand1);
printf("Enter 2nd number: ");
scanf("%d", &operand2);
printf("%d", mul(operand1,operand2));
break;
case 4:
printf("Enter 1st number: ");
scanf("%d", &operand1);
printf("Enter 2nd number: ");
scanf("%d", &operand2);
printf("%f", dib(operand1,operand2));
break;
default:
printf("That is not a valid choice.");
break;
}
}

//Addition
int add(int x,int y){
int z = x + y;
return z;
}
//Subtraction
int sub(int a,int b){
int c = a - b;
return c;
}
//Multiplication
int mul(int d,int e){
int f = d * e;
return f;
}
//Division
float dib(float g,float h){
float i = g / h;
return i;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote