Question

JAVA Write a psedudocode. A psedudocode is a series of step by step instructions, in basic...

        JAVA 
        Write a psedudocode. A psedudocode is
        a series of step by step instructions, in basic English
        that outlines how you will write your program.
        
        Here is what I expect to see:
        A) How does your program take three inputs from the keyboard?
                
        B) How do you make sure at least two of the inputs are single digits
        between 0 and 9?

    C) How do you make sure the program takes a character 
        from the keyboard, representing one of five operations 
        from the keyboard: +(addition), -(subtraction), 
        *(multiplication), /(division), and ^(exponentiation)?

    D) How do you make sure the program outputs the description 
        of the operation in plain English, as well as the numeric result?
0 0
Add a comment Improve this question Transcribed image text
Answer #1

PSEUDOCODE:

int a, b;
char c;
do
{
   a=INPUT int;
}while(a<0 or a>9);
do
{
   b=INPUT int;
}while(b<0 or b>9);
do
{
   c=INPUT char;
}while(c!='+' and c!='-' and c!='*' and c!='/' and c!='^');
int result;
switch(c)
{
   case '+':
   result=a+b;
   break;
   case '-':
   result=a-b;
   break;
   case '*':
   result=a*b;
   break;
   case '/':
   result=a/b;
   break;
   case '^':
   result=a^b;
   break;
}
OUTPUT result;

int a, b; char c; do a=INPUT int; } while(a<0 or a>9); b=INPUT int; }while(b<0 or b>9); do COINPUT char; }while(c!=+ and c!

We use the do-while loops to validate the inputs and then we use a switch-case to calculate the result and display it.

Add a comment
Know the answer?
Add Answer to:
JAVA Write a psedudocode. A psedudocode is a series of step by step instructions, in basic...
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
  • 6. Consider a C program that reads two real numbers from the keyboard followed by a character where the character can b...

    6. Consider a C program that reads two real numbers from the keyboard followed by a character where the character can be one of the operators +,-, *, 1, or % providing the addition, subtraction, multiplication, division, or remainder respectively. Then the result is displayed on the screen For example, if the user types 2.0 3.0 % then your code will display: Note: In the above example the inputs are real numbers but the remainder only performs an integer operation....

  • Write a C++ Program that simulates a basic calculator using functions which performs the operations of...

    Write a C++ Program that simulates a basic calculator using functions which performs the operations of Addition, Subtraction, multiplication, and Division. ( make sure you cover the case to avoid division by a zero) Display a menu for list of operations that can be calculated and get the input from user about his choice of calculation. Based on user choice of operation, take the input of number/numbers from user. Assume all input values are of type double. Calculations must be...

  • Write a C++ Program that simulates a basic calculator using functions which performs the operations of...

    Write a C++ Program that simulates a basic calculator using functions which performs the operations of Addition, Subtraction, multiplication, and Division. ( make sure you cover the case to avoid division by a zero) Display a menu for the list of operations that can be calculated and get the input from the user about his choice of calculation. Based on user choice of operation, take the input of number/numbers from user. Assume all input values are of type double. Calculations...

  • A Simple Calculator Summary: Write a console program (character based) to do simple calculations (addition, subtraction,...

    A Simple Calculator Summary: Write a console program (character based) to do simple calculations (addition, subtraction, multiplication and division) of two numbers, using your understanding of Java. Description: You need to write a program that will display a menu when it is run. The menu gives five choices of operation: addition, subtraction, multiplication, division, and a last choice to exit the program. It then prompts the user to make a choice of the calculation they want to do. Once the...

  • Write a program that reads a char as an input from the keyboard and outputs whether...

    Write a program that reads a char as an input from the keyboard and outputs whether it is a valid character to start an identifier. (Hint: look for a method in for the Character class.) Please do this in java.

  • Write an assembler program that asks the user (as shown below) for two integers and a...

    Write an assembler program that asks the user (as shown below) for two integers and a single character representing the arithmetic operations: addition, subtraction, multiplication and integer division (displays both quotient and remainder). Perform the requested operation on the operands and display the result as specified below. Assume SIGNED NUMBERS. The program should not divide by 0! If the user attempts to divide by 0, display the error message: "Cannot divide by zero." If this error occurs, the program should...

  • IN JAVA: Write a program that displays a menu as shown in the sample run. You...

    IN JAVA: Write a program that displays a menu as shown in the sample run. You can enter 1, 2, 3, or 4 for choosing an addition, subtraction, multiplication, or division test. After a test is finished, the menu is redisplayed. You may choose another test or enter 5 to exit the system. Each test generates two random single-digit numbers to form a question for addition, subtraction, multiplication, or division. For a subtraction such as number1 – number2, number1 is...

  • Creating a calculator for my CS1 class and my code was able to run but it...

    Creating a calculator for my CS1 class and my code was able to run but it crashes near the end. As far as I know, the error means that it's retrieving "null" from the variable but I haven't seen that kind of error from this kind of situation. I would appreciate any help. I'm just starting up in Java so I apologize if this is a silly question. Thank you! ``` ----jGRASP exec: java CS1Calculator ------------ Welcome to the CS1...

  • Must write in Java - ignore the Junit tests Write a program that works with fractions....

    Must write in Java - ignore the Junit tests Write a program that works with fractions. You are first to implement three methods, each to perform a different calculation on a pair of fractions: subtract, multiply, and divide. For each of these methods, you are supplied two fractions as arguments, each a two-element array (the numerator is at index 0, the denominator is at index 1), and you are to return a resulting, simplified fraction as a new two-element array...

  • Write a Python Program that displays repeatedly a menu as shown in the sample run below....

    Write a Python Program that displays repeatedly a menu as shown in the sample run below. The user will enter 1, 2, 3, 4 or 5 for choosing addition, substation, multiplication, division or exit respectively. Then the user will be asked to enter the two numbers and the result for the operation selected will be displayed. After an operation is finished and output is displayed the menu is redisplayed, you may choose another operation or enter 5 to exit the...

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