1 / 6

More Algorithms

This article discusses the process of writing generic algorithms for drawing solid and outline rectangles, along with error checking for dimensions. It also explains the concept of finding the floor of a real number X. The article includes information on upcoming assignments, exams, and additional topics to be covered.

jsoliz
Download Presentation

More Algorithms

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. More Algorithms Topics • More Algorithms

  2. Writing Algorithms • Given a problem statement, we are going to write the corresponding generic algorithm for the solution in terms of input and output. • We will use the following procedure: • Define variables using comments. • Get input from the user. • Perform tasks or calculations in order to get the correct solution. • Output results to the user.

  3. Drawing a Solid Rectangle Problem: Write an interactive program that will draw a solid rectangle of asterisks (*) in terms of width and length. The program must also display the dimensions of the rectangle. Error checking must be done to be sure that the dimensions are greater than or equal to one.

  4. Drawing an Outline Rectangle Problem: Write an interactive program that will draw an outline rectangle of asterisks (*) in terms of width and length. The program must also display the dimensions of the rectangle. Error checking must be done to be sure that the dimensions are greater than or equal to two.

  5. Floor of X • Given a real number X, floor of X, denoted X , is the largest integer that is less than or equal to X. • For example, 3.9 = 3 7.0 = 7 -2.8 = -3

  6. Assignment and Next • Exam 1 on Wednesday Oct. 2. • Homework 3 due on Monday, Sept. 30, 2:00 PM. • Visit out class at least once a day: http://www.cs.umbc.edu/courses/undergraduate/104/fall02/chen/ Next: • Go over Homework 2. • More algorithms. • Review for the Exam 1.

More Related