CS 105

CS 105

Lab 4

CS 105 Fall 1014CS 105

Objectives:

1.

Gain an understanding of how to implement a loop.

2.

Learn to use a loop counter to determine how many times the loop iterates.

3.Learn to use a variable of String data type.

4.Learn to store and append information in a String variable with the concatenation operator.

5.

Learn to use the newline

character to format String output.

6.

Learn to use a multiline

TextBox, with ReadOnly set to True, to display output.

7.Learn to use the absolute value function.

8.Gain an understanding of the Golden Ratio and the Fibonacci Numbers.

DUE DATES:

11 am Section: THURSDAY OCTOBER 30 BY THE END OF LAB

2 pm Section: THURSDAY OCTOBER 31 BY THE END OF LAB

INTRODUCTION:

If you have a line segment, there are an infinite number of ways you can divide the segment into two parts, but there is only one way to divide it such that it has the following property:

This concept is known as the golden ratio and is defined as follows:

The above information was obtained at the following Web Site:

http://en.wikipedia.org/wiki/Golden_ratio

Additional information on the subject may be found at the following sites:

http://www.mathsisfun.com/numbers/golden-ratio.html

(Khan Academy)

The Fibonacci sequence of integers was introduced to the Western world by Leonardo Fibonacci in his Liber Abaci. If you begin with the integers 0 and 1, each successive integer in the series is obtained by adding the previous two, to obtain the following:

0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233…

What is the relationship between the Fibonacci numbers and the golden ratio? The ratio of the last two Fibonacci integers calculated converges to the golden ratio.

Additional information may be found at the following:

http://www.ted.com/talks/arthur_benjamin_the_magic_of_fibonacci_numbers.html

http://mathworld.wolfram.com/FibonacciNumber.html

http://www.youtube.com/watch?v=kkGeOWYOFoA

http://www.youtube.com/watch?v=AzfHbETDbN8

Fibonacci in music?

http://www.youtube.com/watch?v=wS7CZIJVxFY

PROBLEM TO SOLVE:

Given a specified “distance” from the golden ratio, determine how many Fibonacci numbers must be generated in order to get this close. Note that there are no units involved; the “distance” is the absolute value of the difference between two numbers of data type Double. To do this you will need to implement a loop.

First complete the Fo Generator program.

After completing the Fo Generator program, make a Lab 4 folder in your CS account; copy the completed Fo Generator program into your Lab 4 folder.

Recall that the project should have been named Golden Ratio. The source code file name should have been named Golden Ratio.vb. Make sure that the form has been named Golden Ratio Form.

Now make the changes needed to convert the Fo Generator program to the program to solve the Lab 4 problem.

Here are a few hints to help you get started:

1. For this project you need to declare only one constant:

Const GOLDEN_RATIO As Double = 1.6180339887

2.To generate an unspecified number of Fibonacci integers, you need to declare only three variables. Just remember to store each new number in a String variable before calculating the next number; this should have been implemented in the Fo Generator program.

3.The difference between the current ratio of the last two fibs and the golden ratio must be unsigned. To do this use the absolute value function as follows:

diff = Math.Abs(GOLDEN_RATIO – ratio)

4.After exiting the loop, display the fib numbers generated to the user in a multiline TextBox; set both the ReadOnly and Multiline properties to True.

5.To determine how many Fibonacci numbers were generated you can set up a loop counter.

6.The concept of a Boolean flag is useful to help you understand how the loop is operating. You can add the flag to the Watch Window.

7.Note that, if needed, you can implement decision making within the body of the loop. This is known as “nesting” selection statements within a repetition statement.

Sample Output:

Maddox Smith

Hey,
Greetings for the day !
Hope that you’re well !

We want to introduce ourselves as a team of professionals who are into academic writing for the last 10+ years. We can provide assignment assistance in all subjects. Our experts can provide solutions across all the topics right from Management, HR, Marketing, Finance & Accounts, Statistics, IT, childcare, nursing, law, and general writing. We provide plagiarism free work and also send a ‘Turnitin’ report along with completed work. Our services are available at reasonable cost; we entertain amendment requests from clients without any extra charges.

Our Feature Included

Ø Every assignment includes graphical representation like pie chart, bar graph, smart art and all.
Ø Free 0% plagiarism report
Ø Expert team for technical work as well.
Ø On time delivery
Ø Multiple rework facility
Ø Huge team of expert in each subject
Ø Referencing like: Harvard, APA, MLA, Oscola, automatic referencing all are familiar to our experts.

Subject we cover: Math , finance, economics, accounts, civil engineering, mechanical engineering, IT, Computer science, electrical and electronics engineering, history, geography, political science, sociology, physiology, philosophy, biology, microbiology, biotechnology, biotechnology, B-school assignments, project report, psychology, nursing assignments, medical assignments, Tourists and travelling assignments all kinds of dissertation and so on

Best Regards:
Oz Paper Help
WhatsApp:+1 585-666-2225
Email:ozpaperhelp@gmail.com
www.ozpaperhelp.com
www.cheapassignmenthelp.co.uk
www.freeassignmenthelp.com

https://www.ozpaperhelp.com/
1 Step 1
GET INSTANT ASSIGNMENT HELP BY PHD EXPERTS FROM UNITED KINGDOM
keyboard_arrow_leftPrevious
Nextkeyboard_arrow_right