Create two classes named Mammals and MarineAnimals. Create another class named BlueWhale
which inherits both the above classes. Now, create a function in each of these classes which prints
"I am mammal", "I am a marine animal" and "I belong to both the categories: Mammals as well as
Marine Animals" respectively. Now, create an object for each of the above class and try calling
function of Mammals by the object of Mammal
function of BlueWhale by the object of BlueWhale
function of each of its parent by the object of BlueWhale
function of MarineAnimal by the object of MarineAnimal
Create a class named Shape with a function that prints "This is a shape". Create another class named Polygon inheriting the Shape class with the same function that prints "Polygon is a shape". Create two other classes named Rectangle and Triangle having the same function which prints "Rectangle is a polygon" and "Triangle is a polygon" respectively. Again, make another class named Square having the same function which prints "Square is a rectangle".
Now, try calling the function by the object of each of these classes.
We want to calculate the total marks of each student of a class in Physics, Chemistry and Mathematics and the average marks of the class. The number of students in the class are entered by the user. Create a class named Marks with data members for roll number, name and marks. Create three other classes inheriting the Marks class, namely Physics, Chemistry and Mathematics, which are used to define marks in individual subject of each student. Roll number of each student will be generated automatically.
Write algorithms for
Create a user defined method named calcCost() that accepts two double values as input (length
and width), and then computes the estimated cost of painting a room (walls only, not ceiling),
assuming the room is rectangular and has four full walls and the walls are 2.6 meter high. The rate
for the painting job is R20 per square meter. Your method should return the estimated cost to the
calling method.
Create a program whose Main() method prompts a user for the length and the width of a room in
meter, then calls calcCost to calculate the estimated cost. Once calculated, you should display
the estimated cost.
Write a program that prompts the user for the following values: nickname and favourite movie/series.
Write a user defined method named displayDetails() that accepts two string values as input,
and then displays these values.
Add the required instructions to your Main() program to allow it to display the text Hello World
and then calls the displayDetails() method to display your information.
create a class called person
populate the class with below private fields
1.First name as an String
2.Last name as an String
3.email id as string
4.Dateofbirth as DateTime
Add a constructor that accept Firstname,Lastname,Email,DateBirth as Parameter
Add read only properties that return the following computer information
1.Isadult a bool- Whether or not the person is over 18
2.Sunsing as string - the traditional western sun sign of the person
3.Isbirthday as bool - wether or not today is the persons birthday
4 ScreenName as string - a default screeb name that you might seen being offered to a first time user of gmail or yahoo(e.g. hari joe born on may 25th,1980 might be hdoe525 or haridoe052580)
Create a class classed employee which should be driven from person class. employee class should add the following properties
1. Salary as double
in the main method created object of employee class and test
the behavior by calling read-only properties
Create a new project, and copy your
code from Task 1 to the new project
(copy the contents of the Main()
method and the displayDetails()
method)
Adapt your Main() method to capture
and display the details for 4 different
people.
The displayDetails() method
should remain unchanged.
There are two types of fishes in a pond, A and B.there are N fishes of type A numbered from 1 to N and M.the following two methods are adopted by the fishes of type A to satisfy their hunger.
1)E1:Fish of typeA(n1) eats the fish of type B(n2).
2)E2:Fish of type A(n1) eats the fish of type A(n2) if size(n1)>size(n2).
In the above mentioned context,E1and E2 denote the respective methods and n1 and n2 are the fishes belonging to these types and Size(X) denotes the total number of fish within X.
Example:if size(L)=3 and size(K)=2 and L eats K then the resulting size(L) will be5.
It is feeding time now and the fishes are hungry.theyeat as per the given method and satiate their hunger.your task is to find and return an array defining whether which type A fishes do All type B fishes fall under.
Note: the size of all fishes initially is the same i.e,1.
Ex1:
i/p1:2
i/p2:3
i/p3:4
i/p4:{{1,1,1},{1,1,2},{1,2,3},{2,1,2}}
o/p:{1,1,1}
ex2:
i/p1:1
i/p2:1
i/p3:1
i/p4:{{1,1,1}}
o/p:{1}
Create a program using python programming language that determines the data type of a user input variables. Declare at least 3 user input variables then print out their data types.