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

Task 1:(Inheritance and Polymorphism)

Make a class named Fruit with a data member to calculate the number of fruits in a basket. Create two other class named Apples and Mangoes to calculate the number of apples and mangoes in the basket. Print the number of fruits of each type and the total number of fruits in the basket.


Do the question with only python



Write a program in which you need to 

Create a class called ‘SHAPE’ (should be made an abstract class) having two instance variable Length (double), Height (double) 

instance method Get Data () to get and assign the values (to length &Height) from the user 

it also has a method Display Area () to compute and display the area of the geometrical object. 

Inherit two specific classes ‘TRIANGLE’ and ‘RECTANGLE’ from the base class that utilize the base class method. 

Using these three classes design a program that will accept dimension of a triangle/rectangle interactively and display the area.

Hint:

Area of Triangle=1/2(L*h)

Area of Rectangle=L*h



Write a program that accepts student mark out of 100, and return the corresponding letter grade based on the following condition:



if mark is greater than or equal to 90 A


if mark is greater than or equal to 80 and less than 90B


if mark is greater than or equal to 60 and less than 80C


if mark is greater than or equal to 40 and less than 60D


if mark is less than 40F


for other cases NG


N.B write the program using both switch and if-else if- else Statements.


It is known that a score for a given course is b/n 0-100

Write a program that gives the maximum value from an array with size 8. The data stored in the array should be accepted from the user and should be an integer value. Write another program which orders the same data in an ascending order



1 Write a program which inputs a person’s height (in centimetres) and weight (in kilograms) and outputs one of the messages: underweight, normal, or overweight, using the criteria:



Underweight: weight < height/2.5



Normal: height/2.5 <= weight <= height/2.3



Overweight: height/2.3 < weight

Create a method named getCircleDiameter that takes a radius of double type as the parameter. The method should return the diameter of a circle. To compute the diameter of a circle, multiply the radius by 2.


Create a class named Account with an instance variable named account_number. Make this class a member of the Accounts namespace. 



Create a Python script that will display the next 5 numbers in the sequence where each number is the sum of the previous two.


TEXT FILE


8 3


4 5


6 2


Output


8 3 11 14 25 39 64


4 5 9 14 23 37 50


6 2 8 10 18 28 46

Python Problem Solving


You're given a positive integer: Perform the sequence of operations as per below guidelines until the value reaches 1:


If N is even --> N / 2

If N is odd --> N * 3 + 1


Print the total number of steps it took to reach 1.


Input

The first line of input contains an integer.


Output

The output should be a single integer denoting the total number of steps.


Explanation

For Example, using N = 10 as the input, with 6 steps.


10 is even - 10/2 = 5

5 is odd - 5 * 3 + 1 = 16

16 is even - 16 / 2 = 8

8 is even - 8 /2 = 4

4 is even - 4/2 = 2

2 is even - 2/2 = 1 --> Reached 1.


So the output should be 6.


Sample Input1

10

Sample Output1

6


Sample Input2

345

Sample Output2

125



Python Program


Write a python program to print the following output.


Input

The first line contains a string S representing a unique id.

The second line contains an integer N representing group length.


Output

The output should be a single string representing the new unique id.



Sample Input1

2-4A0r7-4k

3

Sample Output1

24-A0R-74K



LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS