Unformatted text preview:

CGS 3460 - Programming Using CFall 2008Assignment #5 Assigned: Tuesday, Sept 23th, 2008Due: Monday, Sept 29nd, 2008 at 11:59 PM Please Note: Any compilation error will be subjected to at least 50% penalty of the total assignment grade.1. Write a C program receives an integer n from user and computes nth Fibonacci number. If user enters a negative quantity, you should print an error message and exit. Save your program in a file called p1.c. A session with the program should look like the following:Hint: Fibonacci numbers are defined as:a0 = 0a1 = 1an = an-1 + an-2,an is the nth Fibonacci number.Example 1:Enter n: 0Desired Fibonacci number is: 0 Example 2:Enter n: 1Desired Fibonacci number is: 1 Example 3:Enter n: 2Desired Fibonacci number is: 1 Example 4:Enter n: 3Desired Fibonacci number is: 2 Example 5:Enter n: -3-3 is NEGATIVE, please try again later…2. Write a C program that receives a float balance from user and manages the balance through various operations. The following operations will be supported by your program:Letter Operation ParametersI Apply Annual InterestInterest rate(%), duration (in years)W Withdraw MoneyAmountD Deposit MoneyAmountQ Quit NoneYour program will print a menu to the user repeatedly and apply the operations each time, until 'quit' option is selected.A session with the program will look like the following:Please enter the initial deposit:1000Select one of the options:----------------------------------* 'A' for applying annual interest* 'W' for withdrawing money* 'D' for depositing money* 'Q' for quittingAEnter interest rate (%): 50Enter duration (years): 2The new balance is: 2250.0Select one of the options:----------------------------------* 'A' for applying annual interest* 'W' for withdrawing money* 'D' for depositing money* 'Q' for quittingWEnter amount to withdraw: 300The new balance is: 1950.0Select one of the options:----------------------------------* 'A' for applying annual interest* 'W' for withdrawing money* 'D' for depositing money* 'Q' for quittingDEnter amount to deposit: 400The new balance is: 2350.0Select one of the options:----------------------------------* 'A' for applying annual interest* 'W' for withdrawing money* 'D' for depositing money* 'Q' for quittingQThe final balance is: 2350.0ByeInstructions for submitting Assignment 51. First compress your program files into a tar file. For this, change to the directory where you have stored both the files. At the terminal command prompt (putty, Linux console, MAC terminal, etc.) type:tar cvf assign5.tar p1.c p2.cLet’s say you have stored your files in assign5 directory your “rain” machine. > cd assign5> lsp1.cp2.c..>tar cvf assign5.tar p1.c p2.c >lsp1.cp2.cassign5.tar….2. If you are working from Windows platform using Putty and WinSCP, you can create a directory assign5 in your home directory on rain machine using putty. Create the directory using this command on putty> cd //to change to the home directory>mkdir assign5 //to create the directory under home directory3. Then transfer p1.c, p2.c to assign5 directory on rain using WinSCP. 4. Go to step 1 to tar the file using putty.5. Use WinSCP to copy assign5.tar from rain machine back to your local computer, say desktop.6. Upload the assign5.tar to WebCT.7. Please check the discussion page for assignment 5 on WebCT for common questions and their


View Full Document

UF CGS 3460 - CGS 3460 Assignment 5

Download CGS 3460 Assignment 5
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 CGS 3460 Assignment 5 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 CGS 3460 Assignment 5 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?