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

2. Write a program to define a two dimensional array of numbers to store 5 rows and 6 columns. Write a code to accept the data, assign it in array, and print the data entered by the user.


Create a Class named BooksDemo accepts and displays the details of books using multidimensional array.


BOOKDemo:-

colName: String[4] = {"Book title", "Author", "Publisher", "Price"}

bookDetails: String[2, 4]

____________________

+Main(args: string[])


Write a program to define a two dimensional array of numbers to store 5 rows and 6 columns. Write a code to accept the data, assign it in array, and print the data entered by the user.


Define a structure having one member variable as “Number”. Add functions to display the square and cube of the number in the same structure. In the main function, Initialize the structure variable, and display the square or the cube based on user’s choice.


Mahesh has created the following code. The purpose is to create Circle and Triangle class by inheriting the Shape Class. Both the inherited classes should override the WhoamI() method of the Shape Class. The code has some bugs. Identify the Bugs and fix them.


public class Shape

{

private void WhoamI()

{

Console.WriteLine("I m Shape");

}

}

class Triangle : public Shape

{

public virtual void WhoamI()

{

Console.WriteLine("I m Triangle");

}

}

public class Circle : public Shape

{

void WhoamI()

{

Console.WriteLine("I m Circle");

}

}

class Program

{

static void Main(string[] args)

{

Shape s;

s = new Triangle();

s.WhoamI();

s = new Circle();

s.WhoamI();

Console.ReadKey();

}

}


Extend Employee class and create two derived classes from this class. The derived classes will be ContractEmployee and PermanentEmployee

The contract Employee class will have Perks as an additional property. The PermanentEmployee will have NoOfLeaves and ProvidendFund Properties.


Task 1: Create these two classes by inheriting from the Employee class.


Task 2: Override the GetSalary Method in these two classes. For Contract employee the new salary will be Salary + Perks. For Permanent Employee the new salary will be Salary – Providend Fund.


Task 3: Create a console application to use these classes. Create a Menu driven application to select the Type of employee. Based on the user selection create the object and accept the details from the user. Also display the salary of the Employee.


Task 4: As we only need to create instance of Contract Employee and Permanent Employee classes, Convert the Employee class to Abstract class. Also make GetSalary method Abstract in the Base class.


Create Supplier instance in SupplierTest class, invoke AcceptDetails method to accept the details of the supplier from the user and invoke DisplayDetails method to display the given details of the supplier.


Supplier:

Supplierid: int

SupplierName: String Supplier Test

City: String ---------------> ________________

PhoneNum: String +Main(String[] args)

Email: String

____________________

+Accept Details(Supplier): Void

+Display Details: Supplier


You need to write a program to manage the Inventory of the used cars.


Task 1: Create a simple text-based “Console Application” in C# to maintain a catalog of used cars. The catalog keeps track of each car's make, model, year, and sale price. The program begins with an empty catalog. The program can perform the following operations:

• Adding a new car

• Modify the details of a particular car

• Search for a particular car in the Catalog

• List all the cars in the Catalog

• Delete a car from the Catalog

• Quit


If an unknown command is entered, the user should be informed and asked to enter another command. Hint:

1) Create a class called as Car. Create appropriate constructors (Default and Parameterized), Properties for the Car class.

2) Use Array to store the Objects of a car.

Once the code is ready, get a peer review done. Maintain the list of issues / bugs identified during the review. You are supposed to fix those issues.


Sanjay has written the following code. The purpose is to create a Bird class and implement function overloading. The code has some errors. Debug the code.


private class Bird

{

public string Name;

public double Maxheight;

public Bird() //Default Constructor

{

this.Name = Mountain Eagle;

this.Maxheight = “500”; // TODO: Add constructor logic here

}

public Bird(string birdname, double max_ht) //Overloaded Constructor

{

this.Name = “Another Bird”;

this.Maxheight = null;

}

public void fly()

{

Console.WriteLine(“this.Name is flying at altitude this.Maxheight”);

}

public void fly(string AtHeight)

{

if(AtHeight <= this.Maxheight)

Console.WriteLine(this.Name + " flying at " + AtHeight.ToString());

elseif

Console.WriteLine(this.Name cannot fly at this height);

}

}

The code in the Main function is as follows:

Bird b = new Bird(“Eagle” , double.Parse(“200”));

b.fly();

b.fly(double.Parse(“300”))


Task 1: Create a library project and define a class called Participant. Define the private members and public properties as follows: EmpId, Name, Company Name, FoundationMarks, WebBasicMarks, DotNetMarks, Total Marks, ObtainedMarks, Percentage Initialise the Total Marks to 300. ObtainedMarks and Percentage are calculated fields.


Task 2: Add 3 constructors, one Default, one parameterised to initialize the members and one static constructor to initialise the company Name to “Corporate Unniversity”


Task 3: Add the following functions to the class: a. To calculate Total Marks. b. To calculate the percentage. c. To return the percentage


Task 4: Create a console application to accept the data about participants, and create the object. The console application should call the appropriate functions to calculate the Total Marks and Percentage. And then Display the percentage.



LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS