VU CS101 Current Assignment No. 1 Spring 2013 Solution

CS101 VU Current Assignment No. 1 Spring 2013 Solution

Assignment No. 01
Semester: Spring 2013
Introduction to Computing-CS101

Total Marks: 20

Due Date: 02-05-2013

Fill the empty columns for the following truth table where A, B and C are three binary inputs in the truth table.

Inputs Output Output Output Output Output
A B C (A´. B´)´ (A´+B)´ (B+C)´ (A. B)´⊕(B+C´) (A⊕ B). (B+C)
1
1
1 1
1
1 1
1 1
1 1 1

SOLUTION:

Agr A true ho to A’ false ho ga or agr A false hy to A’ true ho ga.
(A.B) agr 2no true hn to true or agr 2no false hn ya aik bhi false ho to false ho ga.
(A’+B’) Agr 2no false hn to false or agr 2no true ya aik bhi true ho to true.
(A⊕B) Agr 2no true to false and agr 2no false to phr bhi false or agr aik bhi true to true ho ga.

Q1 Solution:

Advertisements

Virtual University CS301 VU Current Assignment No. 2 Spring 2013 Solution

CS301 VU Current Assignment No. 2 Spring 2013 Solution

Assignment – Marks: 20 – Last Date 2 May 2013

Suppose three movies (Harry Potter, English Vinglish and Tekken) are on display in a cinema. Three different  counters are distributing tickets for each movie. To purchase a particular movie ticket, you are required to standing the respective movie counter queue.

Considering the above scenario, write a C++ program which asks a user to choose the movie for which he/she would like to purchase a Ticket. While choosing the movie ticket, user should be asked to enter his/her social group [F for female, M for male and K for kids].

The required program functionalities should be:

> Take input for all the three movies.
> Display the total number of visitors for each movie.
> Display total revenue of cinema and total revenue of each movie (Suppose price of one ticket is 650/-).
> Display the best business earning movie of the cinema.
> Check the popularity of each movie amongst social groups (females, males or kids).

Solution Guidelines:

1) To purchase the movie ticket, viewer must have to stand in the queue. The length of the queue can vary so you have to implement queue as link list.

2) Create a class named Viewer (Node class); this class should create a node for each ticket. This class should define two private data members, social group and Next pointer. A constructor, getter and setter functions for each data member should also be defined in this class.

Note: While getting the value for social group, restrict the user to only enter ‘f’ or ‘F’ for female, ‘m’ or’ M’ for male and ‘k’ or ‘K’ for kids.

3) Create another class named Mov_Que (List class); to create a queue for each movie, this class should define three variables, Front pointer, Rear pointer and counter. The class should also define the following functions:
a) Constructor(): Default constructor of the class.
b) Destructor(): Destructor to destroy the memory gained by the use of new operator.
c) add_Ticket(): This method should enter the new ticket purchased at the rear.
d) Total_Visitors(): This method should return the total number of visitors of movie.
e) Total_Revenue(): This method should return the total revenue of the movie.
f) Popularity(): This method should check the popularity of the movie amongst social group, whether the movie is popular among males, females or kids.

4) In main() function of the program, create three objects of the class Mov_Que which will act like three counters at cinema. These objects should be able to perform all the required functionalities mentioned in the question statement.

5) To get the idea about exact output of program, see Demo.wmv file attached with assignment file.

SOLUTION: