Assignment 3- Module 4

docx

School

Algonquin College *

*We aren’t endorsed by this school

Course

8116

Subject

Computer Science

Date

Jan 9, 2024

Type

docx

Pages

5

Uploaded by BarristerFog13090

Report
Samantha-Rae Belanger 041059377 November 26 th 2023 Assignment 3 – Java Structure: Algorithm Intro to computer Programming 23F_CST8116_472 Prof: Dr. Istiaque Shahriar
Samantha-Rae Belanger 041059377 November 26 th 2023 Java Structure : Algorithm Algorithms 1. Describe the following in your own words: a. What is an algorithm? An algorithm is a step by step process used to solve problems. b. Why do we use algorithms? The ability to define clear steps in solving problems is crucial. It allows us to break down problems and conceptualize solutions in terms of clear steps. Computer programs are, at their core, algorithms written in a way a computer can understand. 2. List and briefly explain all algorithm testing techniques. Algorithm testing can be done in different ways such as: Desk checking – A manual method of tracing steps using sample inputs and outputs. This process is useful for verifying the logic and syntax. Dry Run – Semi-manual method that executes the algorithm on a computer or simulator with sample inputs/outputs. This process is useful for checking functionality and performance. Unit testing – Automated method which writes and runs test cases to cover different scenarios and edge cases. This process is useful for correctness and robustness.
Samantha-Rae Belanger 041059377 November 26 th 2023 a. Which technique is the most efficient? To test efficiently, using a combination of the 3 methods depending on the stage of development and the type of algorithm. Test cases should be clear, concise, and relevant. 3. Find the area of a circle of radius r ( A = π r 2 ) Start Input the value of “r” Area = 3.14*r*r End 4. Write an algorithm to read 2 numbers and find their sum Start Input value of n1 Input value of n2 Sum = n1+n2 End 5. Covert Fahrenheit to Celsius ( ° C= ( °F-32) / 1.8) Start Input value of F Celsius = ( f-32) / 1.8 End 6. Write an algorithm to find the greater number between 2 numbers. Start Input value of n1 Input value of n2 If n1 > n2 Print n1 If n1<n2 Print n2 End
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help
Samantha-Rae Belanger 041059377 November 26 th 2023 7. Write an algorithm to find the largest value of any 3 numbers. Start Input value of a, b and c If a > b and a > c Print a If a < b but b > c Print b If a < b and b < c Print c End
Samantha-Rae Belanger 041059377 November 26 th 2023 References Pirzada, Amy. 2020,Nov, 5. My Coding Place. Retrieved from https://www.mycodingplace.com/post/what-is-an-algorithm-and-why-are-they-important Powered by Al.2023.Linked In. Retrieved from https://www.linkedin.com/advice/0/what-most-efficient- way-test-algorithm-skills-operating-systems#choose-a-testing-method Module 3 and 4. 2023. Algonquin College. Retrieved from https://brightspace.algonquincollege.com/d2l/le/content/573307/Home? itemIdentifier=D2L.LE.Content.ContentObject.ModuleCO-9057568