Date: Wed, 29 Nov 2000 11:25:40 -0600 (CST) From: Mark Jacobson To: 810-030-01@uni.edu Subject: Friday's quiz and program... Hi 030 students, Friday we will have a short quiz. It will also include the final exam ballot question. The Friday quiz will consist of 10 to 20 multiple choice, True/False and fill in the blank questions. Fill in the blank can include write a single line of code, such as printing a random number between 1 and 365 to represent a birthday or displaying a message saying Go UNI Panthers or asking the user with an InputBox() what their name is and setting the Caption property of a Label or a Form to that.. Label1.Caption = InputBox("What is your name") The only type of questions on Friday quiz will be multiple choice, True/False and fill in the blank (as described above in some cases). --------------------------------------------------------------------------- The rest of the class will be related to problem solving and the Ghostbusters and Waggle dancing bees handouts from today's class. I will try to integrate that discussion of problem solving with hints and lessons and debriefing from the current programming assignment. --------------------------------------------------------------------------- If this is your first ever programming class and you need help and hints on the triangular losing last letters word problem or on the ********* ******* Panthers ***** Panther *** Panthe * problem Pant Pan Pa P check the class web page and/or come see me for help. I'll also accept the program without penalty until 5 p.m. on Friday afternoon, if you need to hear the additional hints and problem solving discussion from Friday morning's class. This mornings class gave lots of hints on how to do the n * square (or narrow rectangle visually on your Form window). ******* <---- n * needed for the top side of the rectangle 1st row * * * * <---- What is an inner row? Describe it in English. Q1 * * * * <---- How many of these inner rows are needed? Q2 * * ******* <---- n * needed for the bottom border last row Q2 is "How many of these inner rows are needed?" The above example consists of 7 rows, and its clear there are 5 rows needed between the 1st row and the last row. When n = 10, there would be 8 rows after 1st row and before the last row. In general, there will be n - 2 rows! 1st row of n * n - 2 rows of left edge * followed by spaces <----- How many spaces? followed by right edge * last row of n * Q1 is "WHAT is an inner row?" Describe it. Understand it. An inner row is an * followed by spaces followed by an *. Type an *, press spacebar 5 times, type another *, press Enter I II III IV Left edge *, n - 2 spaces, right edge *, advance to next line I II III IV The idea of top-down development and stepwise refinement is part of VET SAT AUC (Very Effective Thinking So As To Avoid Unmastered Complexity) - - - - - - - - - From the top level, the problem is described as" WHAT Print the n * by n * box (rectangle) on the form HOW Do the 1st line of n * Step 1 These 3 steps, the HOW Do the n - 2 inner lines Step 2 are a refinement of the Do the last line of n * Step 3 one step, the WHAT of the entire program. Step 1.a Using a for loop, print the n * one at a time and Step 1.b then advance to a new line by using print without ; Step 2.a Print the 1st * (the left edge * for an inner row) Step 2.b Print the n - 2 spaces that are inside or between * Step 2.c Print the last or closing or right edge * Step 2.d Advance to the next line, this one is done Do you see the STEPWISE REFINEMENT and the TOP DOWN DEVELOPMENT illustrated above? Do you see any Visual Basic code or do you see an example of pseudocode and of heeding the programming proverb: "RESIST THE URGE TO CODE"? Looks like 2.a and 2.c and 2.d are detailed enough and simple and clear enough to translate into Visual Basic, or we could take 2.a and/or 2.b and do the: 2.a.i. Print n *, one at a time, I am thinking FOR loop 2.a.ii. Advance to the next line (Print without an ;) 2.b needs to be refined. 2.b.i. print the n - 2 spaces 2.b.ii. advance to the next line That should be enough hints for the print an n by n hollow rectangle using * as the border! :-) See page 81 of textbook and review the STRING functions such as LEFT and MID and RIGHT and LEN to solve the UNI UN I problem..... Remember that for loops can specify a different STEP size for the ***** *** * problem....... Step 10 For i = 20 to 100 Step 10 print i; Next i Step -2 For i = 21 to 1 Step -2 print i; Next i Mark