Computing with C# and the .NET Framework

Total Page:16

File Type:pdf, Size:1020Kb

Computing with C# and the .NET Framework

Errata for Computing with C# and the .NET Framework Copyright 2003 Art Gittleman p. 24 Line 22 Change "code with" To "code without" p. 32 Line 10 Change "print and println" To "Write and WriteLine" p. 37 Line 3 Change "final" To "const" p. 57 Line 4 Change "may not have any parameters, and it may not" To "might not have any parameters, and it might not" p. 71 Line 3 Change "3 <= 4" To "3 < = 4" p. 79 Figure 3.5 Remove the arrow pointing straight down from the Condition box p. 149 Footnote 5 Change to "C# will implicitly convert an int to a float, but there may be a loss of precision because an int may have more than 7 digits." p. 165 Exercise 38 Change "4.14" To :4.12" p. 195 Line 2 Change "be large" To "be too large" p. 208 Line 11 Change ";;" To ";" p. 225 Line 10 Change "2,7" To "2,5" p. 226 Line 21 Change "For strings s1" To "For strings s, s1" p. 226 Add after line 22 "String s = "a houseboat"; p. 226 Line 24 Change "String s2 = s.substring(2,7);" To "String s2 = s.substring(2,5);" p. 234 Line 20 Change "-15" To "-1" p. 237 Line 25 Change "variable" To "variables" p. 263 Lines 19 and 22 Change "y.Length" To "x.Length" p. 268 Line 14 Change "BankAccount account[0]" To "account[0]" p. 297 Change to comment in Example 8.1 to "/* Counts the number of PAINT events. */" p. 305 Line 8 Change "six font styles, FontStyle.Plain," To "five font styles," p. 305 Line 5 from the bottom Change "six equal parts" To "five equal parts" p. 311 Example 8.5 The example also moves the triangle when the user clicks outside of it. A few modifications make it so that only a MouseDown inside will move it. using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms; public class TryMouse : Form { private Point[] vertices = {new Point(50,100), new Point(100,50), new Point(150,100)}; private GraphicsPath p = new GraphicsPath(); private Region region; private int oldX = 100; private int oldY = 75; private bool inside = false;

public TryMouse() { Size = new Size(300,200); Text = "Try Mouse"; BackColor = Color.White; p.AddPolygon(vertices); region = new Region(p); } protected override void OnPaint(PaintEventArgs e) { Graphics g = e.Graphics; g.FillRegion(Brushes.Red, region); base.OnPaint(e); } protected override void OnMouseDown(MouseEventArgs e) { if (region.GetBounds(CreateGraphics()).Contains(e.X, e.Y)) inside = true; base.OnMouseDown(e); } protected override void OnMouseUp(MouseEventArgs e) { if (inside) { region = region.Clone(); region.Translate(e.X-oldX, e.Y-oldY); oldX = e.X; oldY = e.Y; inside = false; Invalidate(); } base.OnMouseUp(e); } public static void Main() { Application.Run(new TryMouse()); } } p. 312 Line 1 Change "Grpahics" To "Graphics" p. 451 After line 12. add "StreamReader f;" p. 451 line 14 Change "StreamReader f" To "f" p. 451 Line 7 from the bottom Change "character" To "characters" p. 503 After line 17 add "Changing three[1] changes list[21] to potato Changing shallow[21] but list[21] remains potato" p. 514 Lines 9 and 14 from the bottom Change "{[leftbrace]0}" To "[{0}" p. 657 Lines 13, 15, 18, and 19 Change "WebPage.html" To "AWebPage.html" p. 631 Line 7 from the bottom Change "trans.C.commit();" To "trans.Commit();" p. 663 Bottom line Change "" To "" p. 677 Line 14 Change "xxxxxxxxxx" To "0-7637-2339-8" p. 682 Line 6 Change "Interface" To "Class" p. 682 Line 9 Change "A superinterface for each" To "Represents a single" p. 705 Line 2 Change "PeriodicTable t = new PeriodicTable();" To "periodictable t = new periodictable();" p. 713 Figure B.1 Change the | table to 0 1 1 1 Change the ^ table to 0 1 1 0 p. 726 In Exercise 9 in five places In Exercise 15 In Exercise 19 Change "System.out.println" To "Console.WriteLine" p. 729 Change the answer to 3 to a. "Hippy diys ire here igiin" b. "Happy days arxkd hxkdrxkd again" p. 729 Change the answer to 5b to -1. p. 737 Line 11 Change "" To "" p. 738 In Chapter 3, Exercise 3 in two places Change "System.out.println" To "Console.WriteLine"

Recommended publications