Question: How do I add a way to accept the decimal inputs that will also display the border created around number ? using static System.Console; class

How do I add a way to accept the decimal inputs that will also display the border created around number ?

using static System.Console; class BorderDemo2 { static void Main() { DisplayWithBorder(2430.49734); DisplayWithBorder(3.25); DisplayWithBorder("Ed"); DisplayWithBorder(3); DisplayWithBorder(456); DisplayWithBorder(897654); DisplayWithBorder("Veronica"); }

private static void DisplayWithBorder(string word) { const int EXTRA_STARS = 4; const string SYMBOL = "*"; int size = word.Length + EXTRA_STARS; int x; for (x = 0; x < size; ++x) Write(SYMBOL); WriteLine(""); WriteLine(SYMBOL + "" + word + "" + SYMBOL); for (x = 0; x < size; ++x) Write(SYMBOL); WriteLine(" ");

} private static void DisplayWithBorder(int number) {

const int EXTRA_STARS = 4; const string SYMBOL = "*"; int size = EXTRA_STARS + 1; int leftOver = number; int x; while (leftOver >= 10) { leftOver = leftOver / 10; ++size; } for (x = 0; x < size; ++x) Write(SYMBOL); WriteLine(); WriteLine(SYMBOL + "" + number + "" + SYMBOL); for (x = 0; x < size; ++x) Write(SYMBOL); WriteLine(" "); } }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!