[SOLVED] Introduction to Programming Languages CECS130   Lab #4.

30.00 $

Category:
Click Category Button to View Your Next Assignment | Homework

You will receive the following solution file(s) instantly after successful payment:

zip file icon Assignment-4.zip (95.7 KB)
Assignment Instructions Updated Recently? Submit Below and we will provide new Solution!
Submit New Instructions
🔒 Securely Powered by:
Secure Checkout
5/5 - (2 votes)

Programming assignment (100 pts): Rewrite your lab 3 calculator program using functions.

Each mathematical operation in the menu should be represented by a separate function.  In addition to all operations your calculator had to support in lab 3, please add additional functionality to your calculator. Include the ability to compute the factorial of an integer (Example: 4! = 1 * 2 * 3 *4 = 24), and an integer power of a number (Example: 53 = 5 * 5 * 5 = 125). Finally, add an interesting mathematical function of your choosing which computes the first n numbers of a sequence of numbers and utilizes an array to store the result before displaying it (Examples of mathematical sequences: Fibonacci, Primes).

 

Example of the output follows:

 

Calculator Menu:

  • Addition
  • Subtraction
  • Multiplication
  • Division
  • Modulus (integers only)
  • Test if prime (integers only)
  • Factorial (integers only)
  • Power
  • Your function
  • Exit

 

Please choose an operation: 8

Enter the first number: 5

Enter the second number: 3

5^3 = 125

 

Calculator Menu:

  • Addition
  • Subtraction
  • Multiplication
  • Division
  • Modulus (integers only)
  • Test if prime (integers only)
  • Factorial (integers only)
  • Power
  • Your function

(0) Exit

Please choose an operation: 0 Good Bye!

 

You program MUST be bug-free, user friendly (verify input from the user), well commented

(Including author information, program description, lab section, date, etc.)

  • Assignment-4.zip