Script Programming: 18IT403 B.Tech., (Semester - IV) Section A
Script Programming: 18IT403 B.Tech., (Semester - IV) Section A
Define the classes shown in the following diagram. The solution should include canonical
I
representation, string representation and overloaded equalto ( == ) operator. (10 M)
Define the classes shown in the following diagram. The solution should include canonical
II
representation, string representation and overloaded equalto ( == ) operator. (10 M)
2
A stack is a collection, meaning that it is a data structure that contains multiple elements.
An ADT is defined by the operations that can be performed on it, which is called an
interface. The interface for a stack consists of these operations: a method to initialize
a new empty stack, push : Add a new item to the stack, pop : Remove and return an
III item from the stack. The item that is returned is always the last one that was added and
is_empty : Check whether the stack is empty. A stack is sometimes called a “Last in,
First out” or LIFO data structure, because the last item added is the first to be removed.
Define the Stack ADT in Python. The solution should include canonical representation,
string representation and overloaded equalto ( == ) operator. (10 M)
The Queue ADT is defined by the following operations: a method to initialize a new
empty queue, insert : Add a new item to the queue, remove : Remove and return an item
from the queue. The item that is returned is the first one that was added and is_empty
IV
: Check whether the queue is empty. Define the Queue ADT in Python. The solution
should include canonical representation, string representation and overloaded equalto (
== ) operator. (10 M)
A company’s PayrollSystem takes a collection of employees and prints their id, name, and
pay amount using the calculate_payroll() method exposed on each employee object. There
are different types of employees depending on how their pay is calculated. The company
V
employees SalariedEmployee whose pay = Basic + DA + HRA. The company also employs
HourlyEmployee that are paid by the hour, so their pay = hours_worked*hourly_rate.
Implement the necessary system in Python. (10 M)