Questions: 1 835

Answers by our Experts: 1 539

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write an application that displays the result of dividing two numbers and displays any

remainder. The main() method prompts the user for values and sends them to the dividing

method; the dividing method performs the calculation and displays the results. Save the

application as Divide.cs


Create a class named Eggs. It’s main () method holds an integer variable named numberOfEggs to

which you will assign a value entered by a user at the keyboard. Create a method to which you pass

numberOfEggs. The method displays the eggs in dozens; for example, 50 eggs is four full dozen (with

2 eggs remaining). Save the application as Eggs.cs


 Create an application named Numbers whose main() method holds two integer variables. Assign

values to the variables. Pass both variables to methods named sum () and difference(). Create the

methods sum() and difference(); they compute the sum of and difference between the values of two

arguments, respectively. Each method should perform the appropriate computation and display the

results. Save the application as Numbers.cs


3. Given a string and substring, write a method that returns number of occurrences of substring in the string. Assume that both are case-sensitive. You may need to use library function here.

Expected input and output

HowManyOccurrences("do it now", "do") → 1

HowManyOccurrences("empty", "d") → 0

4. Write a program in C# Sharp to count a total number of duplicate elements in an array.

Test Data :

Input the number of elements to be stored in the array :3

Input 3 elements in the array


1. Given a sequence of brackets, write a method that checks if it has the same number of opening and closing brackets.

Expected input and output

CheckBracketsSequence("((()))") → true

CheckBracketsSequence("()(())(") → false

CheckBracketsSequence(")") → false

2. Given a string, write a method that counts its number of words. Assume there are no leading and trailing whitespaces and there is only single whitespace between two consecutive words.

Expected input and output

NumberOfWords("This is sample sentence") → 4

NumberOfWords("OK") → 1


1. Write a C# Sharp program to find the sum of first 10 natural numbers. Go to the editor

Expected Output :

The first 10 natural number is :

1 2 3 4 5 6 7 8 9 10

The Sum is : 55

2. Write a program in C# Sharp to make such a pattern like a pyramid with numbers increased by 1.

1

2 3

4 5 6

7 8 9 10


Write a program in C# Sharp to calculate and print the Electricity bill of a given customer. The customer id., name and unit consumed by the user should be taken from the keyboard and display the total amount to pay to the customer. The charge are as follow :

Unit Charge/unit

upto 199 @1.20

200 and above but less than 400 @1.50

400 and above but less than 600 @1.80

600 and above @2.00

If bill exceeds Rs. 400 then a surcharge of 15% will be charged and the minimum bill should be of Rs. 100/-

Test Data :

1001

James

800

Expected Output :

Customer IDNO :1001

Customer Name :James

unit Consumed :800

Amount Charges @Rs. 2.00 per unit : 1600.00

Surchage Amount : 240.00

Net Amount Paid By the Customer : 1840.00


Write a C# Sharp program to read temperature in centigrade and display a suitable message according to temperature state below :

Temp < 0 then Freezing weather

Temp 0-10 then Very Cold weather

Temp 10-20 then Cold weather

Temp 20-30 then Normal in Temp

Temp 30-40 then Its Hot

Temp >=40 then Its Very Hot

Test Data :

42

Expected Output :

Its very hot.


2. Write a C# Sharp program that takes a number and a width also a number, as input and then displays a triangle of that width, using that number.

Test Data

Enter a number: 6

Enter the desired width: 6

Expected Output :

666666

66666

6666

666

66

6


1. Write a method that prints 10 by 10 multiplication table. Remember about readibility (spaces in the right place).

Expected input and output

1 2 3 4 5 6 7 8 9 10

2 4 6 8 10 12 14 16 18 20

3 6 9 12 15 18 21 24 27 30

4 8 12 16 20 24 28 32 36 40

5 10 15 20 25 30 35 40 45 50

6 12 18 24 30 36 42 48 54 60

7 14 21 28 35 42 49 56 63 70

8 16 24 32 40 48 56 64 72 80

9 18 27 36 45 54 63 72 81 90

10 20 30 40 50 60 70 80 90 100


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS