New version page

UGA CSCI 1301 - Lab10

Documents in this Course
Load more
Upgrade to remove ads

This preview shows page 1 out of 2 pages.

Save
View Full Document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Upgrade to remove ads
Unformatted text preview:

CSCI 1301 – Lab 10/06/08 - 10/07/08 Exercise The purpose of this exercise is to apply your knowledge about repetition/loop statements discussed during the lectures. The value of the number e can be approximated by the sum: !1!31!21!11!01ne +++++= L Write a program called EulerApproximation that asks the user for an integer greater than 1 and computes the approximation of the number e using the series specified above. If the user enters an invalid integer, an integer less than or equal to 1, the program will display an error message and request the input again until the user enters an integer greater than 1. Afterwards, the program will compute and display the approximation of the number e by summing the sum of the terms of the above series according to the value of n entered by the user. The expression n! is the factorial of n defined as: The number e is also called Euler’s number to honor the Swiss mathematician Leonard Euler who first studied the number e in the 1720s. For more information, please check http://en.wikipedia.org/wiki/E_(mathematical_constant). Sample Runs Example 1 Please enter an integer >=1: 10 The approximation of the number e for n=10 is 2.7182818011463845 Example 2 Please enter an integer >=1: -1 You must enter an integer greater than 1. Please enter an integer >=1: 4 The approximation of the number e for n=4 is 2.708333333333333 Hint: The exercise can be solved without using any nested loops! 1 if n=0 n! = 1*2*3*…*n if n > 0Compile, run and test your program. After you have completed this exercise, demonstrate it to your lab instructor. WebCT Submission After you have completed both exercises in this lab, upload the java file EulerApproximation in WebCT and submit it to receive


View Full Document
Download Lab10
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lab10 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lab10 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?