using System;
using System.Text;
/*
User interface contains two types of user input controls:
TextInput, which accepts all characters and NumericInput, which accepts only digits.
Implement the class TextInput that contains:
Public method void Add(char c) - adds the given character to the current value
Public method string GetValue() - returns the current value
Implement the class NumericInput that:
Inherits TextInput
Overrides the Add method so that each non-numeric character is ignored
For example, the following code should output "10":
TextInput input = new NumericInput();
input.Add('1');
input.Add('a');
input.Add('0');
Console.WriteLine(input.GetValue());
*/
class TextInput {
private System.Text.StringBuilder sb = new System.Text.StringBuilder();
public void Add(char c){
sb.Append(c);
}
// public string GetValue(){
// return currentString.toString();
// }
}
namespace MyCompiler {
class Program {
public static void Main(string[] args) {
Console.WriteLine("Hello world!");
}
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: