Please note that I am not asking for an answer to the exercise just abit more explanation

I have this question that I do not understand.

Using a class to wrap simple stream input (InputWrapper.cs) modify following program to
calculate area of a triangle given base and height

using System; 
class Triangle 
{ 
 static void Main() 
 { 
 //Sample code to calculate area of triangle 
double Base = 15; 
 double height = 5; 
 double area = Base * height / 2; 
 Console.WriteLine("Area = {0}", area); 
 Console.Read(); 

 } 
} 



// InputWrapper.cs 
// Class to wrap simple stream input 
// Datatype supported: 
// int 
// double 
// decimal 
// string 
using System; 
class InputWrapper 
{ 
 public int getInt(string prompt) 
 { 
 Console.Write(prompt); 
 string buf = Console.ReadLine(); 
 return Convert.ToInt32(buf); 
 } 
 public double getDouble(string prompt) 
 { 
 Console.Write(prompt); 
 string buf = Console.ReadLine(); 
 return Convert.ToDouble(buf); 
 } 
 public decimal getDecimal(string prompt) 
 { 
 Console.Write(prompt); 
 string buf = Console.ReadLine(); 
 return Convert.ToDecimal(buf); 
 } 
 public string getString(string prompt) 
 { 
 Console.Write(prompt); 
 string buf = Console.ReadLine(); 
 return buf; 
 } 

Could someone who may understand what is asked please give me abit of a clearer explanation?

Thankyou

Instead of using double Base = 15; on line 7 in your Main,
use a method from the InputWrapper class.
Example: change line 7 with
double Base InputWrapper.getDouble("What is base of triangle?");
Do the same sort of thing on line 8.
Success!

Thanks alot!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.