Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using C# create a single console application. In it (and outside the curly brackets of class program), create a class MyLab. All the following functions

Using C# create a single console application. In it (and outside the curly brackets of "class program"), create a class "MyLab". All the following functions must be defined in this new class with public scope. Also illustrate calling each function from void main in the class "program".

image text in transcribed

1. Develop a public function that displays a prompt a user to enter a numeric value, checks that it is a numeric value within a specified range (if not, displays an error message and again displays the prompt), and returns the result (as type double). The prompt to display must be passed as an argument to the function. The range should also be passed as optional min and max arguments (use largest negative and positive double values as defaults). p 2. Develop a public function that calculates and returns the average length of a server queue. For an M/M/1 queue (single server, exponential processing and arrival rates), Lq=; while for an M/G/1 queue (single 1-p 2203+p server, exponential arrival rate and any distribution for processing rate) Lq = pis utilization of the 2(1-P) server (a value = 0 and 0), and os is the standard deviation of the server processing time (value > 0). These values should be passed to the function (a and os should be optional arguments). Use an enumeration to define the queue type. The function should print an error message and then throw an exception if any of the arguments are out of range. 3. Write a public void function that takes two values A and B (both int) and swaps their values (puts A value in B and B value in A using ref keyword). 4. Write a public function Mult that passed a variable length list of numeric values, returns their multiplication (ITX;). The list may have a variable number of values. For example, Mult(5,7,9,12,2) should return 7560, and Mult(5,6,3,0) should return 0 5. Write a public polymorphic void function to write out a label (text string) and a value to a console. The label and value are passed as arguments to the function. You should have separate versions of the function for double, int, Date Time, String, and Boolean type values. The label should be written out in a 20 character wide left aligned field, followed by the value: a. Double values should be written out in #,##0.00 format (14 character wide field, right align), b. Integers values should be written out in #,##0 format (14 character wide field, right align) c. Date values should be written out as short dates (14 character wide field, left align) d. Strings values should be written out as is (14 character wide field, left align, truncate string to 14 characters if needed) e. Boolean values should be written out left aligned in a 14 character wide field

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Marketing The Ultimate Marketing Tool

Authors: Edward L. Nash

1st Edition

0070460639, 978-0070460638

More Books

Students also viewed these Databases questions