Programming & Computer Science Answers

C++ 9913
Python 5288
Java | JSP | JSF 3611
C 1680
C# 1362
Computer Networks 989
Algorithms 652
Databases | SQL | Oracle | MS Access 641
HTML/JavaScript Web Application 588
Other 537
Visual Basic 358
Assembler 209
Software Engineering 202
AJAX | JavaScript | HTML | PHP 166
MatLAB 150
MatLAB | Mathematica | MathCAD | Maple 124
Action Script | Flash | Flex | ColdFusion 112
UNIX/Linux Programming 89
Web Development 73
Excel 36
ASP | ASP.NET 23
Delphi | Pascal 21
Perl 16
Prolog 9
Functional Programming 9
MathCAD 5
Wolfram Mathematica 4
WPF 4
Ruby | Ruby on Rails 3
NodeJS Web Application 2

Questions answered by Experts: 26 876

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

Q1: Write a Program in C++ which completes following requirements:

a. Create a class, having a static function printing some information and invoke that method using scope resolution operator.

b. Try to access non-static data members from static method and write in comments what happens.

c. Declare and initialize a static variable as counter in a function (increment it in every call) and call it multiple times printing the change in value

d. Write about your observations while making this assignment in a word file about static variables and static methods


 You are writing a line of code that should ask the user to input the balance of their bank account in dollars and cents. The program will then perform a multiplication problem to tell the user how much interest they can earn. Identify three errors in your line of input code and explain why they are incorrect. Include the corrected line of code in your answer. Here is the code:

1num = input(What is your balance?)


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();

}

}


Create a Java Project With Your name as “YourNameProjectQNo1”, add a class to this Project, Class name should be Your Name with Your Reg No as “YourNameYourRegNo

a. Add a Method to Accept names and marks of n students from user, enter the value of n from User

b. Ensure that valid data is entered. If user enters an invalid data, then appropriate message should be displayed using Message Dialog Box e.g. ‘Name cannot be a number’ or ‘Marks must be an integer value’

c. Add another Method, to Display this data in descending order according to marks such that name of student.  



Q.No.2. Design an abstract class GeometricObject with lineColor as data member. GeometricObject must ensure that its children implement calcArea() method.  [Marks : 03]

 

Design RectangleYourRegNo and CircleYourName Classes as children of GeometricObject class with overridden toString() method to return “Rectangle with w Width and h Height is drawn” OR “Circle with r Radius is drawn”. The attributes of Rectangle are length, width. The attribute of Circle is          radius

Hint: Area of circle=πr2 , Area of rectangle= width*length


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 a class: Doctor, with private data members: id, name, specialization and salary with the public member function: get_data () to take input for all data members, show_data () to display the values of all data members and get specialization () to return specialization. Write a program to write for detail of n doctors by allocating the memory at run time only.


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”))


LATEST TUTORIALS
APPROVED BY CLIENTS