[Solved] CS271- Assignment 2

$25

File Name: CS271-_Assignment_2.zip
File Size: 178.98 KB

SKU: [Solved] CS271- Assignment 2 Category: Tag:
5/5 - (1 vote)

Write a program to calculate Fibonacci numbers.

  • Display the program title and programmers name. Then get the users name, and greet the user.
  • Prompt the user to enter the number of Fibonacci terms to be displayed. Advise the user to enter an integer in the range [1 .. 46].
  • Get and validate the user input (n).
  • Calculate and display all of the Fibonacci numbers up to and including the nth The results should be displayed 5 terms per line with at least 5 spaces between terms.
  • Display a parting message that includes the users name, and terminate the program.

Requirements:

  • The programmers name and the users name must appear in the output.
  • The loop that implements data validation must be implemented as a post-test loop.
  • The loop that calculates the Fibonacci terms must be implemented using the MASM loop
  • The main procedure must be modularized into at least the following sections (procedures are not required this time):
    1. introduction
    2. userInstructions
    3. getUserData
    4. displayFibs
    5. farewell
  • Recursive solutions are not acceptable for this assignment. This one is about iteration. 6) The upper limit should be defined and used as a constant.
  • The usual requirements regarding documentation, readability, user-friendliness, etc., apply.
  • Submit your text code file (.asm) to Canvas by the due date.

Notes:

  • It is not necessary to store the Fibonacci numbers in an array. The terms may be displayed as they are generated.
  • The second-order Fibonacci sequence is defined as:
    1. The first two terms are both 1.
    2. All other terms are calculated as the sum of the two previous terms.
    3. The reason for restricting n to [1 .. 46] is that the 47th Fibonacci number is too big for DWORD data type.

Example (see next page)

page 1 of 2

Example (user input in italics):

Fibonacci Numbers

Programmed by Leonardo Pisano

Whats your name? Paul

Hello, Paul

Enter the number of Fibonacci terms to be displayed Give the number as an integer in the range [1 .. 46].

How many Fibonacci terms do you want? 50 Out of range. Enter a number in [1 .. 46]

How many Fibonacci terms do you want? 14

1 1 2 3 5

8 13 21 34 55

89 144 233 377

Results certified by Leonardo Pisano.

Goodbye, Paul.

Extra-credit options (original definition must be fulfilled):

  1. Display the numbers in aligned columns.
  2. Do something incredible.

To ensure you receive credit for any extra credit options you did, you must add one print statement to your program output PER EXTRA CREDIT which describes the extra credit you chose to work on. You will not receive extra credit points unless you do this. The statement must be formatted as follows

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] CS271- Assignment 2
$25