Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

csci 1010-1011 lab 5. i need help with the rest of this assignment Choose one of the following options: 1. Perform an arithmetic operation 2.

csci 1010-1011 lab 5. i need help with the rest of this assignment
image text in transcribed
image text in transcribed
image text in transcribed
Choose one of the following options: 1. Perform an arithmetic operation 2. Apply a function 3. Calculate a factorial 4. Exit the program 1 Enter an expression of the form NUM OP NUM: 8 / 2 Result: 4 Choose one of the following options: 1. Perform an arithmetic operation 2. Apply a function 3. Calculate a factorial 4. Exit the program 4 Thank you for using Edith Clarke's calculator 11. Replace the output statement in case 2 with code that does the following: (a) Prompt the user to enter an expression of the form FUNC ARG. (b) Read a String representing the function name, and a double representing the argument. C) Use a switch statement with the String variable as the controlling expression to determine the function the user entered. (d) If the function is one of log in or sqrt apply the function to the argument using the Math.log10, Math.log, or Math.sert methods respectively, and display the result. (C) For the default case, display an error indicating the user entered an unknown function 12. Run your program to see if it works. Here is an example of what the output should look like: Choose one of the following options: 1. Perform an arithmetic operation 2. Apply a function 3. Calculate a factorial 4. Exit the program 2 Enter an expression of the form FUNC ARG: log .891 Result: -3.0 Choose one of the following options: 1. Perform an arithmetic operation 2. Apply a function 3. Calculate a factorial 4. Exit the program 2 Enter an expression of the form FUNC ARG: sin e Unrecognized function: sin Choose one of the following options: 1. Perform an arithmetic operation 2. Apply a function 3. Calculate a factorial 4. Exit the program 4 Thank you for using Edith Clarke's calculator 13. Replace the output statement in case 3 with code that does the following: (a) Prompt the user to enter a number. (b) Read an int. c) Create a variable to store the result and initialize it to 1. (d) Use a while loop to multiply the result by every number between 1 and the number the user entered. (e) Display the result to the user. 14. Run your program to see if it works. Here is an example of what the output should look like: Choose one of the following options: 1. Perform an arithmetic operation 2. Apply a function 3. Calculate a factorial 4. Exit the program 3 Enter a number: 4 Result: 24 Choose one of the following options: 1. Perform an arithmetic operation

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions

Question

2. What do you believe is at the root of the problem?

Answered: 1 week ago