1 Write a C program to print your name, date of birth, mobile numbers and university’s name on separate line.
2 Write a C program to perform addition, subtraction, multiplication and division of two integer
numbers, respectively 2 and 6 and show the result on the screen.
3 Write a C program to input a number from user and print multiplication table of the given
number using for loop.
4 Write a C program to input number from user and check number is palindrome or not using
while loop.
5 Write a C Program to calculate the Average of an array elements where the elements are
received as input.
Inventory Class Design an Inventory class that can hold information and calculate data for items in a retail store’s inventory. itemNumber, quantity, cost and totalCost (calculated as quantity times cost). Constructor Accepts an item’s number, cost, and quantity as arguments. The function should copy these values to the appropriate member variables and then call the setTotalCost function. SetItemNumber Accepts an integer argument that is copied to the itemNumber member variable. setQuantity Accepts an integer argument that is copied to the quantity member variable. setCost Accepts a double argument that is copied to the cost member variable. setTotalCost Calculates the total inventory cost for the item ( quantity times cost) and stores the result in totalCost.
getItemNumber Returns the value in itemNumber.
getQuantity Returns the value in quantity.
getCost Returns the value in cost.
getTotalCost Returns the value in totalCost.
Demonstrate the class in a driver program.
required to store and analyze data about 6 car manufacturer's sales data in all the 12 months of a year. Demonstrate how you would store the data in a two dimensional matrix and do the following
1. Write a function to Find for a given car manufacturer, the month in which, maximum no. of cars are sold.
2 Write a function to Find the average number of cars sold for each car manufacturer 3. Write a function to Find the total number of cars sold for each car manufacturer 4. Write a function to find standard deviation for a given car manufacturer
1. Copy the countdown function from Section 5.8 of your textbook.
def countdown(n):
if n <= 0:
print('Blastoff!')
else:
print(n)
countdown(n-1)
Write a new recursive function countup that expects a negative argument and counts “up” from that number. Output from running the function should look something like this:
>>> countup(-3)
-3
-2
-1
Blastoff!
Write a Python program that gets a number using keyboard input. (Remember to use input for Python 3 but raw_input for Python 2.)
If the number is positive, the program should call countdown. If the number is negative, the program should call countup. Choose for yourself which function to call (countdown or countup) for input of zero.
Provide the following.
The code of your program.
Output for the following input: a positive number, a negative number, and zero.
An explanation of your choice for what to call for input of zero.
Write a sample program that enters 10 numbers and Display all on the 1 st stack. Then after, display all the even numbers on the 2 nd stack and odd numbers on the 3 rd stack.
Suppose there is a dictionary named exam_marks as given below.
exam_marks = {'Cierra Vega': 175, 'Alden Cantrell': 200, 'Kierra Gentry': 165, 'Pierre Cox': 190}
Write a Python program that takes an input from the user and creates a new dictionary with only those elements from 'exam_marks' whose keys have values higher than the user input (inclusive).
===================================================================
Sample Input 1:
170
Sample Output 1:
{'Cierra Vega': 175, 'Alden Cantrell': 200, 'Pierre Cox': 190}
WAP to implement the following hierarchy using multiple inheritance
publisher author
book
Assume, you have been given a tuple with details about books that won the Good Reads Choice Awards.
book_info = (
("Best Mystery & Thriller","The Silent Patient",68821),
("Best Horror","The Institute",75717),
("Best History & Biography","The five",31783 ),
("Best Fiction","The Testaments",98291)
)
Write a Python program that prints the award category, the book name, and its total votes earned as shown below.
Output:
The Silent Patient won the 'Best Mystery & Thriller' category with 68821 votes
The Institute won the 'Best Horror' category with 75717 votes
The five won the 'Best History & Biography' category with 31783 votes
The Testaments won the 'Best Fiction' category with 98291 votes
===================================================================
Using Overloading Constructor
Write a class named ‘Rectangle’ with 2 instance variables:
Variables: length and width (both type double)
Also create a method that will compute the area of a rectangle
The class should have 3 constructors:
i. No parameter – values of both length and width are assigned zero
ii. 1 parameter – both the length and width will be assigned with same number
iii. 2 parameters – 2 numbers are assigned as length and width respectively
Also create a class with Main Method, where you will:
Create 3 objects of the class Rectangle:
one with no parameters
one with 1 parameter
another one with 2 parameters
Allow the user to enter the value for the objects that requires parameter(s)
Print the area of the Rectangle for each object.
Write the code to display a table consisting of four rows and six columns. The first column should contain the numbers 1 through 4 raised to the first power. The second column should contain the result of raising the number in the first column to the second power. The third column should contain the result of raising the number in the first column to the third power, and so on. Use two for statements: one to keep track of the numbers 1 through 4, and the other to keep track of the powers (1 through 6).