CST1620 C# / C++ Programming
Lab Week 2


Good article on formatting strings containing data:
http://blog.stevex.net/index.php/string-formatting-in-csharp/

 

Exercises

Exercise 3.4 (10 points)

Here are some annual rainfall figures for the country of Xanadu, which we wish to display graphically:

    1998    150 cm
    1999    175 cm
    2000    120 cm
    2001    130 cm

Use filled rectangles to display the data.

  Result (Save to your local machine and run)

Note: Extra credit if you are able to display the graph data as soon as the window form opens. (4 points)

Exercise 3.9 Console (10 points)

Write an application that inputs from the user the radius of a circle and prints the circle's diameter, circumference, and area.  Use the following formulas (r is the radius):

diameter = 2r
circumference = 2πr
area = πr2

Write this application as a console application (No window forms).

  Result (Save to your local machine and run)

Exercise 3.9 (10 points)

The math logic in this exercise is the same as above.  Write an application that inputs from the user the radius of a circle and prints the circle's diameter, circumference, and area.  Use the following formulas (r is the radius):

diameter = 2r
circumference = 2πr
area = πr2

Write this application as a standard Windows application (Using a GUI).

  Result (Save to your local machine and run)