Create a console application on Visual Studio using C#

 C# on Visual Studio

 

A teacher is willing to calculate the sum of the three lowest marks and determine the
difference between the highest and lowest marks of his students. You are required to
create a console application for the teacher that:
• Prompts the teacher to enter the number of students.
• Uses a function that accepts an array of marks as argument and returns the
sum of the three lowest marks and the difference between the lowest mark and
the highest mark.

Note:
• The display should be done in the main program.
• Your program should not accept any mark less than 0 and greater than 100.

in progress
Programming Languages 1 Answer John Smith

Is starvation possible for the below algorithms?

Starvation 

Indicate the algorithms, from those listed below, that could result in starvation and explain why. You can assume that each process will use the CPU for a finite burst before performing I/O. 

i. First-come, First-Served 

ii. Round Robin (aka preemptive FCFS) 

iii. Shortest Job First 

iv. Shortest Remaining Time First (aka preemptive SJF) 

v. Priority 

Solved
Operating System 1 Answer Anonymous(A) Post

C++ program that maintains its data.

C++ program that maintains its data (of type integer) sorted in ascending order. The program will consist of three functions: insert, delete, and print. You may use any data structure of your choice as long as the data remains sorted after each operation.

For example, if 5 is inserted then 2, the structure should contain 2 then 5, and that's what the print function should show. If 3 is inserted afterward, then we should have 2,3,5. Same for deletion, of course, the structure will remain sorted, but the deleted number should be excluded.

Solved
Programming in C,C++ 1 Answer Anonymous(s) Post

Design an algorithm for path visit.

For a DAG with n nodes and m edges (and assume m ≥ n), design an algorithm to test if there is a path that visits every node exactly once. The algorithm should run in O(m) time.

Solved
Programming in C,C++ 2 Answer Anonymous(s) Post

Develop a solution to implement below rules using semaphores.

A bridge on a busy highway is damaged by a flood. One-way traffic is to be instituted on the bridge by permitting vehicles traveling in opposite directions to use the bridge alternately. The following rules are formulated for the use of the bridge:

  1. (1) At any time, the bridge is used by vehicle(s) traveling in one direction only.
  2. (2) If vehicles are waiting to cross the bridge at both ends, only one vehicle from one end is allowed to cross the bridge before a vehicle from the other end starts crossing the bridge.
  3. (3) If no vehicles are waiting at one end, then any number of vehicles from the other end is permitted to cross the bridge.

Develop a solution to implement these rules using semaphores.

Solved
Device Management 1 Answer Anonymous(s) Post

Write a function to convert a string to upper case.

Write a function to convert a string to upper case (without using toupper). Your function should take a char as a parameter and return nothing (modifying the existing string rather than returning a new one).

Note: A single char is actually an 8-bit integer, where each letter, digit, and punctuation symbol is represented by a fixed integer "ASCII" value. Uppercase and lowercase letters have sequential values; e.g. 'B' == 'A' + 1 and 'b' == 'a' + 1. Use this information to work out how to convert a single character to uppercase. You can find the values for all characters by looking up an ASCII table. However, you don't actually need to know them. You can simply use 'A', 'B', etc.

Try implementing this function in several different ways:

(a) Using the strlen() function and retrieving each character in turn with the array indexing notation (array[i]).
(b) Without using strlen(). (Hint: how do you know where a string ends?)
(c) Without using the array indexing notation. (Hint: modify the string pointer itself.)

Use this function in your program so that the first command-line parameter is the case- insensitive (i.e. so that the user can enter "sum", "SUM", "Sum", "suM", etc.).

Solved
Programming in C,C++ 1 Answer Anonymous(s) Post

Is providing anonymous statistical data to government agencies to improve roads and traffic flow unknown to the customers is privacy violation?

A company that makes navigation devices that collects location data from the devices to provide real-time services to its customers. It also provides anonymous statistical data to government agencies to improve roads and traffic flow. Unknown to the company and its customers, the police used the data to choose sites for traffic cameras to catch speeders.

Was this a privacy violation? Why or why not? Justify your answer. 

Solved
Computer Network Security 1 Answer Anonymous(s) Post

Simple program to copy one file to another.

Create a simple program to copy one file to another.
Your program should do the following:

(a) Accept two command line parameters — the source and destination filenames — checking whether they are correctly specified.
(b) Open the source file for reading, and the destination file for writing.
(c) Check that they both opened correctly, and report an error if appropriate.
(d) Read the source file character-by-character, and write each character to the destination file.
(e) Stop when the end of the source file is reached.
 

Note: The final read operation will fail — that's when you detect the end of the file. Make sure not to write an extra bogus character to the destination file.

(f) Close both files when complete.

Solved
Programming in C,C++ 1 Answer Anonymous(s) Post