Implement a User Interface Menu •The project will be written in JavaScript and n
ID: 3605677 • Letter: I
Question
Implement a User Interface Menu•The project will be written in JavaScript and needs to be generated in Visual Studio.
Required structures and tools: • Switch/Case
Description: Users will be presented with instructions telling them to enter a digit from 1 to 4.
When the user executes the function, they will see text that says "You have called Menu Option " and the number they entered. If users enter anything other than digits from 1 to 4, the function should not fail or cause errors. Rather, users will receive the message, " You have not entered a number from 1 to 4."
Please make sure it meets the following criteria.
•Function works and produces the results requested by the specifications
•Algorithms are clearly written and embedded into the code as comments.
•Variables and functions have useful names which follow a naming convention
•The code layout will include tabs that clearly indicate each working sub-units and spaces between lines at appropriate points.
•Error handling will be used. Implement a User Interface Menu
•The project will be written in JavaScript and needs to be generated in Visual Studio.
Required structures and tools: • Switch/Case
Description: Users will be presented with instructions telling them to enter a digit from 1 to 4.
When the user executes the function, they will see text that says "You have called Menu Option " and the number they entered. If users enter anything other than digits from 1 to 4, the function should not fail or cause errors. Rather, users will receive the message, " You have not entered a number from 1 to 4."
Please make sure it meets the following criteria.
•Function works and produces the results requested by the specifications
•Algorithms are clearly written and embedded into the code as comments.
•Variables and functions have useful names which follow a naming convention
•The code layout will include tabs that clearly indicate each working sub-units and spaces between lines at appropriate points.
•Error handling will be used. Implement a User Interface Menu
•The project will be written in JavaScript and needs to be generated in Visual Studio.
Required structures and tools: • Switch/Case
Description: Users will be presented with instructions telling them to enter a digit from 1 to 4.
When the user executes the function, they will see text that says "You have called Menu Option " and the number they entered. If users enter anything other than digits from 1 to 4, the function should not fail or cause errors. Rather, users will receive the message, " You have not entered a number from 1 to 4."
Please make sure it meets the following criteria.
•Function works and produces the results requested by the specifications
•Algorithms are clearly written and embedded into the code as comments.
•Variables and functions have useful names which follow a naming convention
•The code layout will include tabs that clearly indicate each working sub-units and spaces between lines at appropriate points.
•Error handling will be used. Implement a User Interface Menu
•The project will be written in JavaScript and needs to be generated in Visual Studio.
Required structures and tools: • Switch/Case
Description: Users will be presented with instructions telling them to enter a digit from 1 to 4.
When the user executes the function, they will see text that says "You have called Menu Option " and the number they entered. If users enter anything other than digits from 1 to 4, the function should not fail or cause errors. Rather, users will receive the message, " You have not entered a number from 1 to 4."
Please make sure it meets the following criteria.
•Function works and produces the results requested by the specifications
•Algorithms are clearly written and embedded into the code as comments.
•Variables and functions have useful names which follow a naming convention
•The code layout will include tabs that clearly indicate each working sub-units and spaces between lines at appropriate points.
•Error handling will be used.
•The project will be written in JavaScript and needs to be generated in Visual Studio.
Required structures and tools: • Switch/Case
Description: Users will be presented with instructions telling them to enter a digit from 1 to 4.
When the user executes the function, they will see text that says "You have called Menu Option " and the number they entered. If users enter anything other than digits from 1 to 4, the function should not fail or cause errors. Rather, users will receive the message, " You have not entered a number from 1 to 4."
Please make sure it meets the following criteria.
•Function works and produces the results requested by the specifications
•Algorithms are clearly written and embedded into the code as comments.
•Variables and functions have useful names which follow a naming convention
•The code layout will include tabs that clearly indicate each working sub-units and spaces between lines at appropriate points.
•Error handling will be used. •The project will be written in JavaScript and needs to be generated in Visual Studio.
Required structures and tools: • Switch/Case Required structures and tools: • Switch/Case
Description: Users will be presented with instructions telling them to enter a digit from 1 to 4.
When the user executes the function, they will see text that says "You have called Menu Option " and the number they entered. If users enter anything other than digits from 1 to 4, the function should not fail or cause errors. Rather, users will receive the message, " You have not entered a number from 1 to 4."
Please make sure it meets the following criteria.
•Function works and produces the results requested by the specifications
•Algorithms are clearly written and embedded into the code as comments.
•Variables and functions have useful names which follow a naming convention
•The code layout will include tabs that clearly indicate each working sub-units and spaces between lines at appropriate points.
•Error handling will be used.
Explanation / Answer
class ReadingNumbers
{
static void Main()
{
Console.Write("a = ");
int a = int.Parse(Console.ReadLine());
Console.Write("b = ");
int b = int.Parse(Console.ReadLine());
Console.WriteLine("{0} + {1} = {2}", a, b, a + b);
Console.WriteLine("{0} * {1} = {2}", a, b, a * b);
Console.Write("f = ");
double f = double.Parse(Console.ReadLine());
Console.WriteLine("{0} * {1} / {2} = {3}",
a, b, f, a * b / f);
}
}
The result of program execution might be as follows (provided that we enter 5, 6 and 7.5 as input):
a = 5
b = 6
5 + 6 = 11
5 * 6 = 30
f = 7.5
5 * 6 / 7.5 = 4
In this particular example the specific thing is that we use parsing methods of numerical types and when wrong a result is passed (such as text) this will cause an error (exception) System.FormatException. This is especially true when reading real numbers, because the delimiter used between the whole and fractional part is different in various cultures and depends on regional settings of the operating system.
a = 5
b = 6
5 + 6 = 11
5 * 6 = 30
f = 7.5
5 * 6 / 7.5 = 4
In this particular example the specific thing is that we use parsing methods of numerical types and when wrong a result is passed (such as text) this will cause an error (exception) System.FormatException. This is especially true when reading real numbers, because the delimiter used between the whole and fractional part is different in various cultures and depends on regional settings of the operating system.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.