Question
Using labview from national instruments
ator that can do the following: addition, subtraction, multiplication, division, (8) Design a calcul square, square root, sinO, coso. T to display results of the operation performed. he front panel should have controls for inputs and an indicator
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Pseudocode:

program calculator

while(True) #main loop
{ #get choice until input="Q"

#print main menu
print("Welcome to the Calculation Program")
print("(1) Addition")
print("(2) Subtraction")
print("(3) Multiplication")
print("(4) Division")
print("(Q) Quit Program")
#finish print main menu

input=getinput from user (1,2,3,4,Q) #ask the user to input a choice and set input as the choice.

if input=="Q", then print("End Calculator"), break #if input is "Q", then exit main loop

if input==1 #Addition
{
while(True) #addition loop until user ends
{
print("Adds two numbers. Enter "Q" to quit") #print directions
x=getinput from user (first number) #Takes user's first input and stores in x
y=getinput from user (second number) #Takes user's second input and stores in y
if (x=="Q" or y=="Q") then break #if Q, exit addition
print(x+y) #print the answer
}
}

if input==2 #Subtraction
{
while(True) #subtraction loop until user ends
{
print("Subtracts two numbers. Enter "Q" to quit") #print directions
x=getinput from user (first number) #Takes user's first input and stores in x
y=getinput from user (second number) #Takes user's second input and stores in y
if (x=="Q" or y=="Q") then break #if Q, exit subtraction
print(x-y) #print the answer
}
}

if input==3 #Multiplication
{
while(True) #multiplication loop until user ends
{
print("Multiplies two numbers. Enter "Q" to quit") #print directions
x=getinput from user (first number) #Takes user's first input and stores in x
y=getinput from user (second number) #Takes user's second input and stores in y
if (x=="Q" or y=="Q") then break #if Q, exit multiplication
print(x*y) #print the answer
}
}

if input==2 #Division
{
while(True) #division loop until user ends
{
print("Divides two numbers. Enter "Q" to quit") #print directions
x=getinput from user (first number) #Takes user's first input and stores in x
while(True) #Loop to check for 0 denominator
{
y=getinput from user (second number) #Takes user's second input and stores in y
if (y is not 0) then break #if y is ok, then stop input y loop
print("Please enter a non-zero denominator") #send error message and get input again with loop
}
if (x=="Q" or y=="Q") then break #if Q, exit division
print(x/y) #print the answer
}
}
#Restart main loop and reprints main menu, etc.
}

Add a comment
Know the answer?
Add Answer to:
Using labview from national instruments ator that can do the following: addition, subtraction, multiplication, division, (8)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT