HW-2_fall2011 - HOMEWORKSET2...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
28 HOMEWORK SET – 2 Introduction to Visual Basic Programming 1. Write a visual basic program that has two buttons, one named “C to F” and the other named “F to C”. The program will read the temperature from cell A1 (entered either in Centigrade or Fahrenheit). When you press the appropriate button, the final answer will be displayed in A2. Use this formula for the “C to F” button: F = 1.8C+32. 2. Identify the type of variables and develop Visual basic syntax to declare and initialize the variables from some cells in column A and output them back into cells in column B. The variables to be declared are: Name, city, age, weight, height, no_of_kids, no_of_cars_owned. The values are: John, Washington D C, 30, 176.8, 6.1, 8, 5. Example: Dim Name as String Name = cells (1,1), where cells(1,1) has “John” ‐‐ inputting step Cells(1,2) = Name ‐‐‐ outputting step 3. The cosine of an angle in radians can be approximated using the Maclaurin series as: cosሺݔሻൌ 1െ ଶ! ସ! ଺! ൅⋯ . where x is in radians. Develop a general method (list the steps) or a flowchart to compute cos(x) for any given angle in radians using 4 terms in the above series. Write a program to compute the approximate value of the cosine using 2 terms, 3 terms, and 4 terms. Use the code to estimate the approximate value of the cosine of 34 degrees. Also compute the exact value using VBA’s internal library function for cosine (COS). Calculate the
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/14/2011 for the course CE 3010 taught by Professor Clement during the Fall '09 term at Auburn University.

Page1 / 4

HW-2_fall2011 - HOMEWORKSET2...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online