Monday, January 31, 2011

Word Problems #1 cont'd

4. There are 33 horses in the field. 15 horses go into the bar. Then 7 com back out. How many horses are standing in the field?

     Dim field, barn, out, total As Double
  
     field = 33
  
     barn = 15
  
     out = 7
  
     total = (field - barn) + out
  
     MessageBox.Show("There are " & total & " horses standing in the field.")  

5. Inglebert has 15 apples and 3 times as many oranges. How many pieces of fruit does she have?
     Dim apples, oranges, total
  
     apples = 15
  
     oranges = 3 * apples
  
     total = apples + oranges
  
     MessageBox.Show("Inglebert has " & total & " pices of fruit.")  

6. a) How many marks did Brian totally obtain in Mathematics(7) and Science(22)?
     Dim math, science, total As Double
  
     math = 7
  
     science = 22
  
     total = math + science
  
     MessageBox.Show("Brian obtained " & total & " marks in Math and Science.")  
b) How many more marks does Andrew need for a perfect score in Mathematics?
     Dim totalMath, brianMath, needMath
  
     totalMath = 25
  
     brianMath = 7
  
     needMath = totalMath - brianMath
  
     MessageBox.Show("Brian needs " & needMath & " more marks for a perfect score.")  
c) What is Andrew's percentage for all of the quizzes together?
     Dim eng, geo, math, science, andrewTotal, total As Double
  
     eng = 12
  
     geo = 19
  
     math = 18
  
     science = 7
  
     andrewTotal = eng + geo + math + science
  
     total = (eng + geo + math + science) / 100
  
     MessageBox.Show("Andrew's percentage is " & FormatPercent(total))  

No comments:

Post a Comment