Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Math Tool Write a program that allows the user to compute the power of a number or the product of two numbers. Your program should

image text in transcribedimage text in transcribed

Math Tool Write a program that allows the user to compute the power of a number or the product of two numbers. Your program should prompt the user for the following information: Type of operation to perform Two numbers (the arguments) for the operation to perform The program then outputs the following informatiorn .The result of the m athematical operation selected. Menu to be displayed for the user MATH TOOL . Compute the power of a number 2.Compute the product of two numbers Note: The user will enter the menu number corresponding to the mathematical operation desired, and NOT the type of operation text. For example, if the user wants to compute the power of a number, he/she would type 1 (not "Compute the power of a number"). Please refer to the Sample Output file for full details of what the program output should look like when it runs. In addition to the main method, your program MUST contain three user-defined methods as follows: 1. Compute the power of a number 2. Compute the product of two numbers 3. Print the formatted result of the mathematical operation When you write each of your methods, be sure to think about the following: What information does the main method need to provide to this method in order for it to work properly? For example, in order to calculate the power of a number, what information does the method need from main? What information does main expect to receive, if any, after this method executes? For example, when calculating the power of a number, what information does main expect to receive back from the method? Extra credit (10 points) Write two additional methods to allow the user to find the larger of two numbers and to compute the difference of two numbers. Modify the method that prints the result of the mathematical operation to support these new options as well. Math Tool Write a program that allows the user to compute the power of a number or the product of two numbers. Your program should prompt the user for the following information: Type of operation to perform Two numbers (the arguments) for the operation to perform The program then outputs the following informatiorn .The result of the m athematical operation selected. Menu to be displayed for the user MATH TOOL . Compute the power of a number 2.Compute the product of two numbers Note: The user will enter the menu number corresponding to the mathematical operation desired, and NOT the type of operation text. For example, if the user wants to compute the power of a number, he/she would type 1 (not "Compute the power of a number"). Please refer to the Sample Output file for full details of what the program output should look like when it runs. In addition to the main method, your program MUST contain three user-defined methods as follows: 1. Compute the power of a number 2. Compute the product of two numbers 3. Print the formatted result of the mathematical operation When you write each of your methods, be sure to think about the following: What information does the main method need to provide to this method in order for it to work properly? For example, in order to calculate the power of a number, what information does the method need from main? What information does main expect to receive, if any, after this method executes? For example, when calculating the power of a number, what information does main expect to receive back from the method? Extra credit (10 points) Write two additional methods to allow the user to find the larger of two numbers and to compute the difference of two numbers. Modify the method that prints the result of the mathematical operation to support these new options as well

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_2

Step: 3

blur-text-image_3

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

T Sql Fundamentals

Authors: Itzik Ben Gan

4th Edition

0138102104, 978-0138102104

More Books

Students also viewed these Databases questions

Question

Describe three other types of visual aids.

Answered: 1 week ago