61

CSE1002 Problem Solving and Object Oriented Programming

CSE1002 Problem Solving and Object Oriented Programming Question Bank

VITspot App v2.0 Now with Question Papers supporting 2.5k+ courses.

Download App
CSE1002 Bonus Practice Sheet Winter 2018

Codes will be updated daily. Keep Checking 🙂 Please Comment out the code names (with IDs) which are not listed here.

Enable Copy Paste in Skillrack

Please Like our Facebook Page: VITspot Facebook Page

You can also Use VITspot Search in Homepage 🙂

Vector of Characters

Chess, Carrom and Scrabble Players

Sort Data in File 

Names that Do Begin with Vowel – Descending Order

Count Words in Tweets 

Customer discount

Recursive reverse

Generic Double Ended Queue

Automatic vending machine

Code Detection Problem

Computing Area of Different Shapes 

Row Maximum of a Matrix

Snakes and Ladders

Find a Route

Arrange Items for Solar Vehicle 

3-D points- multiply and increment

College Application

List of even Points

Special Pay Increase Problem

Black Coin in Board game

Verification of ‘L’ shaped arrangement of coins on game board

Cost of Pizza

Class Average Problem 

How to Serve a Coffee?

Symmetric Matrix

Polygon in a Two Dimensional Space 

Jobs with and without Priority

Tender scrutiny using reference variable

Second Smallest Number

Count the Number of Items

String operations 

Happy Coding

Click Here to Leave a Comment Below 61 comments
NISHANT AGGARWAL - March 24, 2018

CSE1002 Verification of circular prime number
CSE1002-Tender scrutiny using reference variable
CSE1002 Cyclic Right Shift of Elements
CSE1002 Boarding Pass
CSE1002 Black Coin in Board game
CSE1002 Check if a Matrix is Sparse or Not
CSE1002 Count Words in Tweets
CSE1002 Find a Route
CSE1002 List of even Points
CSE1002 Names that Do Begin with Vowel

we want solution of these bonus practice problems

46
2

Reply
Drake - March 25, 2018

We really need solutions for two vector operation questions

1.Vector operations (Id-1327)
Design a class vector to perform the operations like retrieving value for i-th component from a vector, add two vectors and subtract a vector from another if they are of same dimension. A vector of n-dimension is represented by an n-tuple (a sequence of n numbers). Addition of two vectors of same dimension, is got by adding the corresponding components of the two vectors. Similarly, subtraction of the two vectors, v1-v2, is got by the subtracting the respective components of v2 from the corresponding components of v1. Overload subscript ([]) operator for retrieving the i-th element from a vector, ‘+’ and ‘-‘ for addition and subtraction, <> for I/O operations. If the vectors are of different dimension, throw an exception stating “Vectors of different dimension cannot be added”.

Input format:
Dimension of first vector, ‘n1’
First element of first vector
Second element of first vector

n1-th element of first vector
Dimension of second vector, ‘n2’
First element of second vector
Second element of second vector

n2-th element of first vector
value of i
value of j

Output Format
i-th element of vector1
j-th element of vector2
sum of vectors
vector1-vector2

2.Vector Operations (Id-2650)
Vectors are used in everyday life to locate individuals and objects. They are also used to describe objects acting under the influence of an external force. A vector, is a quantity with a direction and magnitude. A vector with magnitude alone, is an n-tuple (list of n numbers) Given two vectors v1, v2, develop an algorithm and the subsequent C++ program to determine the sum and dot product of the two vectors. Sum of v1 and v2, written as v1+v2, is got by adding the respective elements: first element of v1+v2 is got by adding the first element of v1 with the first element of v2; second element of v1+v2 is got by adding the second element of v1 and the second element of v2 and so on. The dot product v1*v2 is a scalar ( a number), which is the sum of the product of the respective elements of v1 and v2. In other words, dot product of two vectors is got by adding : the product of the first element of v1 with the first element of v2, product of the second element of v1 with the second element of v2 and so on

if the input vectors v1 and v2 are:

v1= 3, 4, -5, 6, 7, 8

v2 = 4, 6, 8, 10, 1, 4

Then sum of the two vectors is 7, 10, 3, 16, 8, 12 and their dot product is : 3*4+4*6+(-5)*8+6*10+7*1+8*4

12+24+(-40)+ 60+7+32=95

Input Format

First line contains the number elements in vector v1 n

Next line contains the number elements in vector v2, m

Next ‘n’ lines contains the elements of the vector v1

Next ‘m’ lines contains the elements of the vector v2

Output Format

First ‘n’ lines contain the sum of the vectors

Next line contains the dot product of the vectors

15

Reply
Drake - March 26, 2018

We also need code detection problem

Code Detection Problem (Id-1529)

For security reasons, messages are transmitted as a secret code over a transmission channel. It is usually sent as a sequence of bits, that is, 0s and 1s. Due to noise in the transmission channel, the transmitted message may become corrupted. That is, the message received at the destination may not be the same as the message transmitted. There are several techniques to check the validity of the transmitted message at the destination. One such technique is to transmit the same message twice. At the destination, both copies of the message are compared. Given a file “data.txt” with the messages that is transmitted, write a C++ program to check whether the message received at the destination is error-free. For simplicity, assume that the secret code representing the message is a sequence of digits(0 to 9) and the maximum length of the message is 250 digits. Each original message is followed by a copy message and first number in both the messages indcates the length of the message. Each character in the message is separated by a space. For example, 7 9 2 7 8 3 5 6 7 9 2 7 8 3 5 6 means that the original message is of length 7 and it is 9 2 7 8 3 5 6 and copy message is also of length 7 and it is 9 2 7 8 3 5 6. If orginal and copy message is same then print Message transmitted is ok. Print Message transmitted is not OK when th length of the original or copy message is greater than 250 or when the original message is not same as copy message.

Input Format:
Name of the file
Input file contains a number of secret codes immediately followed their copy

Output Format:
Print either Message transmitted is ok or Message transmitted is not ok

6
2

Reply
Sourav - March 26, 2018

CSE1002 Identify machines in same local network
CSE1002 Recursive Fibonacci
CSE1002 Customer discount
CSE1002 Count the Number of Items
CSE1002 Count Words in Tweets
CSE1002 List of even Points
CSE1002 3-D points- multiply and increment
please solve these ….i am unable to solve them..

Reply
Drake - March 26, 2018

Guys, the hyperlink to the bonus practice problem “How to serve coffee” https://vitspot.com/code/class-average-problem/ directs us the the class average problem instead.

1
1

Reply
    VITspot Team - March 26, 2018

    Posted Updated! 🙂
    Thanks <3

    Reply
      srk123 - March 26, 2018

      There are many codes that arent there over here. Please make it sure that you upload all the codes.
      CSE1002 Verification of circular prime number
      CSE1002 Recursive reverse
      CSE1002 Vector operations
      CSE1002 Customer discount
      CSE1002 Insert into a Generic Box
      CSE1002 Generic Double Ended Queue
      CSE1002 Count Words in Tweets
      CSE1002 Names that Do Begin with Vowel- descending order.

      11
      1

      Reply
Drake - March 26, 2018

Thanks a lot for putting up all these code. They are extremely helpful!

Reply
Chakradhar - March 26, 2018

Customer discount problem is not there

Reply
harry mahesh - March 26, 2018

AUTOMATIC VENDING MACHINE and GENERIC DOUBLE ENDED QUEUE are not there try to get the code

Reply
NISHANT AGGARWAL - March 26, 2018

Plz update its solution

A circular prime number is a prime number ‘p’ with a property that all the numbers got by cyclically permuting the digits of ‘p’, are also a prime number.

A number is said to be a prime if it has no factors other than the number 1 and itself. 19937 is a circular prime number, as all the numbers obtained by cyclically permuting the number 19937 : 99371, 93719,37199,71993,19937 are all prime.

Develop an algorithm and write a C program to check if the given number is a circular prime or not.

Input Format

A number

Output Format

Print Circular prime or Not circular prime

Reply
NISHANT AGGARWAL - March 26, 2018

update its solution also

Given a set of elements stored in an array and a number ‘m’, design an Algorithm and write the subsequent C program to perform cyclic right shift of the array by ‘m’ places. For example, if the elements are 12, 13, 16, 7, 10 and m =2 then the resultant set will be 7, 10, 12, 13, 16.

Input Format

Number of elements in the set: ‘n’

element-1

element-2

element-n

value of ‘m’

Output Format

Elements in the set after right shift by ‘m’ places

Reply
Md Sameer - March 26, 2018

Please upload Code for Generic Double Ended Queue

Reply
Tarunya - March 27, 2018

Please upload code for problem -‘ Insert into a Generic Box ‘

Reply
dharma teja u - March 27, 2018

cse 1002
batch 4
bonus practice problems
cyclic right shift of elements id-1243
sort a given set of points id-1534
generic right shift id-1538
vector operations id-2650
these four questions are not there please update these

5
1

Reply
Selena Moirangthem - March 27, 2018

Please upload solutions for
Id 1053 identify machines in same local network
Id 1244 leaders of elements
Id 1323 boarding pass
Id 1490 check if a matrix is sparse or not

Reply
Sudharani - March 27, 2018

Id 1248 salary of employees
Id 1327 vector operations
Id 1538 generate right shift
Id 2650 vector operations

Reply
Ayush Dhiman - March 27, 2018

Please upload code for Insert into a Generic Box
and Arrange Items for Solar Vehicle

Reply
yoyoyo - March 27, 2018

Sort Data in File (Id-1532) is not there

Reply
drumit modi - March 27, 2018

RECURSIVE FIBONACCI ID-1249
Given the value of ‘n’, write a recursive routine in C to print the first ‘n’ elements of the Fibonacci series. Fibonacci series is obtained by the sum of the preceding two terms in the series. The first two terms are 0 and 1.

Eg.,

for n=7,

the Fibonacci terms are 0,1,1,2,3,5,8

Input Format

Value of ‘n’

Output Format

Fibonacci series of ‘n’ terms, each term separated by a space

VECTORS OF CHARACTERS ID-1498

Design a class charVector that has a character vector as datamember. Provide member functions in the class to createVector, duplicateVector, duplicateRevVector and print. Functions shall be defined as follows:

initializeVector – read a string and create a vector of characters

duplicateVector – Add the content of the vector once at the end. For example if the content of charVector is “bat” then after the function is called the content must “batbat”

CHECK IF MATRIX IS SPARSE OR NOT ID-1490

duplicateRevVector – Add the content of the vector in reverse at the end. For example if the content of charVector is “bat” then after the function is called the content must “battab”

print – Print content of vector, use iterators for traversal

Use the vector class defined in STL for the implementation. Use [] operator in functions duplicateVector, duplicateRevVector and use iterator in print and initializeVector functions.

Input Format

String to be stored in vector1

String to be stored in vector2

Output Format

Print duplicateVector of vector1

Print duplicateRevVector of vector2

SORT A GIVEN SET OF POINTS ID-1534

Design a OOP model to represent a point in a two dimensional space and overload the operators >>,< and ==. Given ‘n’ points, design an algorithm and write a C++ code to sort them in descending order. While sorting, a point is said to be greater than the other based on their x-coordinate value. If value of x-coordinate is same for both the points then make a decision based on their value of y-coordinate.

Input Format

Number of points ‘n’

value of X- coordinate of point1

value of Y- coordinate of point1

….

value of X- coordinate of point-n

value of Y- coordinate of point-n

Output Format

Print ‘n’ points in sorted order

value of X- coordinate and Y- coordinate of point1 separated by tab

value of X- coordinate and Y- coordinate of point2 separated by tab

….

value of X- coordinate and Y- coordinate of point-n separated by tab

CHECK IF GIVEN MATRIX IS SPARSE OR NOT ID-1490

There are numerous applications of matrices, both in mathematics and other sciences. Some of them merely take advantage of the compact representation of a set of numbers in a matrix. Few to mention the application of matrices are game theory, economics, graph theory, quantum theory, probabilty theory and statistics. Each type of application use different type of data. Design a generic class matrix with functions to check if a matrix is sparse and add two matrices. A matrix is said to be sparse, if the number of zero’s in the matrix is larger than the number of non-zero elements. Define a user defined exception mismatchDimension and throw it when the dimension of matrix1 is not equal to dimension of matrix 2. Print “Dimension of matrices do not match” when the exception is caught.

Input Format:

Number of rows in matrix1

Number of columns in matrix1

Element1 in matrix1

Element2 in matrix1

Elementn in matrix1

Number of rows in matrix2

Number of columns in matrix2

Element1 in matrix2

Element2 in matrix2

Elementn in matrix2

Output Format:

Print elements of resultant matrix or Dimension of matrices do not match if exception is caught

Element1 in resultant matrix

Element2 in resultant matrix

Elementn in resultant matrix

Matrix is sparse or Matrix is not sparse

Reply
drumitmodi - March 27, 2018

779

Reply
Pawan - March 27, 2018

the Generic Double Ended Queue problem’s code showing following error
/tmp/tmp7yWcpy/Hello.cpp:90:46: error: no ‘bool deque::pushB(T)’ member function declared in class ‘deque’
template bool deque::pushB(T data) {
^
/tmp/tmp7yWcpy/Hello.cpp:93:46: error: no ‘bool deque::pushF(T)’ member function declared in class ‘deque’
template bool deque::pushF(T data) {
^
/tmp/tmp7yWcpy/Hello.cpp:107:36: error: no ‘T deque::popF()’ member function declared in class ‘deque’
template T deque::popF() {
^
/tmp/tmp7yWcpy/Hello.cpp:110:36: error: no ‘T deque::popB()’ member function declared in class ‘deque’
template T deque::popB() {
^

Reply
Pawan - March 27, 2018

Kindly update these problems
(i)CSE1002 Salary of Employees (Id-1248)
A company stores the following details of employees such as name, employee id, basic pay, % of DA and HRA. Given details of ‘n’ employees of an organization, Write an algorithm and a C code to

i. get the details of each employee.

ii. print their employee id

iii. Total salary.

Total salary = Basic Pay + % of DA * basic pay + HRA.

Input Format

value of ‘n’

Employee name of employee1

Employee id of employee1

Basic pay of employee1

Percentage of DA of employee1

HRA of employee1

Employee name of employee – n

Employee id of employee – n

Basic pay of employee – n

Percentage of DA of employee – n

HRA of employee – n

Output Format

Employee id of employee1

Total salary of employee1

Employee id of employee2

Total salary of employee2

Employee id of employee – n

Total salary of employee – n

(ii)CSE1002 Recursive Fibonacci (Id-1249)

Given the value of ‘n’, write a recursive routine in C to print the first ‘n’ elements of the Fibonacci series. Fibonacci series is obtained by the sum of the preceding two terms in the series. The first two terms are 0 and 1.

Eg.,

for n=7,

the Fibonacci terms are 0,1,1,2,3,5,8

Input Format

Value of ‘n’

Output Format

Fibonacci series of ‘n’ terms, each term separated by a space

(iii)CSE1002 Vector operations (Id-1327)

Design a class vector to perform the operations like retrieving value for i-th component from a vector, add two vectors and subtract a vector from another if they are of same dimension. A vector of n-dimension is represented by an n-tuple (a sequence of n numbers). Addition of two vectors of same dimension, is got by adding the corresponding components of the two vectors. Similarly, subtraction of the two vectors, v1-v2, is got by the subtracting the respective components of v2 from the corresponding components of v1. Overload subscript ([]) operator for retrieving the i-th element from a vector, ‘+’ and ‘-‘ for addition and subtraction, <> for I/O operations. If the vectors are of different dimension, throw an exception stating “Vectors of different dimension cannot be added”.

Input format:
Dimension of first vector, ‘n1’
First element of first vector
Second element of first vector

n1-th element of first vector
Dimension of second vector, ‘n2’
First element of second vector
Second element of second vector

n2-th element of first vector
value of i
value of j

Output Format
i-th element of vector1
j-th element of vector2
sum of vectors
vector1-vector2

Code:
#include
using namespace std;
class vector
{
int num;
int ele[20];
public:
friend istream& operator>>(istream&,vector&);
friend ostream& operator<>v1;
cin>>v2;
cin>>i;
cin>>j;
cout<<v1[i]<<endl;
cout<<v2[j]<<endl;
v3 = v1+v2;
cout<<v3;
v3 = v1 – v2;
cout<<v3;
}

Reply
gowtham - March 27, 2018

verification of circular prime numbers(Id-1051)
leader of elements(Id-1244)
grade of a student(Id-1489)
vector operations(Id-2650)

Reply
Vansh Kathuria - March 29, 2018

CSE1002 Leaders of Elements
CSE1002 Salary of Employees

Reply
harshita - March 30, 2018

Please get the codes for leader of elements and sort the given set of points

Reply
anil - March 30, 2018

CSE1002 Leaders of Elements (Id-1244)(c++)
Given a set of ‘n’ elements in an order, identify all the leaders and print them. An element is said to be a leader if all the elements to its right are smaller than it. For example, if the elements are 12, 13, 16, 7, 10 then there is only one leader element 16. If there are no leaders in the given set of elements then print ‘No leaders’.

Input Format

Number of elements in the given set: ‘n’

element-1

element-2

element-n

Output Format

Elements that are leaders. Else, print ‘No leaders’ when there is no leader.

Reply
Mayank Mishra - April 1, 2018

CSE 1002 Check if a matrix is sparse or not (ID-1490)

Reply
Abhinav - April 2, 2018

pls post solutions for
CSE1002 Cyclic Right Shift of Elements (Id-1243)
CSE1002 Sort a Given Set of Points

error in
CSE1002 Names that Do Begin with Vowel- descending order

Reply
RAHUL KUMAR - April 3, 2018

Insert into a Generic Box (Id-1492)

The given doesn’t working properly please fix it.

Reply
raghav - April 4, 2018

CSE1002 Identify machines in same local network
CSE1002 Cyclic Right shift of elements
CSE1002 Insert into a Generic Box
Please upload these codes

Reply
Daksh - April 5, 2018

I think the solutions for these are left. If you would kindly help:

CSE1002 Identify machines in same local network
CSE1002 Recursive Fibonacci
CSE1002 Vector operations
CSE1002 Generic Right Shift
CSE1002 3-D points- multiply and increment

Reply
vivek - April 7, 2018

CSE1002 Leaders of Elements (Id-1244) Author:

Given a set of ‘n’ elements in an order, identify all the leaders and print them. An element is said to be a leader if all the elements to its right are smaller than it. For example, if the elements are 12, 13, 16, 7, 10 then there is only one leader element 16. If there are no leaders in the given set of elements then print ‘No leaders’.

Input Format

Number of elements in the given set: ‘n’

element-1

element-2

element-n

Output Format

Elements that are leaders. Else, print ‘No leaders’ when there is no leader.

Reply
Rishabh Kansal - April 9, 2018

*** CSE1002 Check if a Matrix is Sparse or Not (Id-1490) *** Solution Please. Tonight is the last date

Reply
Spiderman - April 21, 2018

Can you post an article on how to calculate the marks for CSE1002.

1
1

Reply
VINITH REDDY - November 7, 2018

hi ,we need questions for course code CSE1001 can u upload them

Reply
FIKSHUN - April 2, 2019

CSE 1002 Generic right shift
Check if a matrix is sparse or not

PLEASE HELP!!!!!!!!!!!!!!!

Reply
DEBJIT - April 7, 2019

INSERT INTO A GENERIC BOX
CHECK IF A MATRIX IS SPARSE OR NOT

Reply
DEBJIT - April 7, 2019

INSERT INTO A GENERIC BOX

CHECK IF A MATRIX IS SPARSE OR NOT

Reply
Gobind - April 9, 2019

Please provide solution for:
Check if a Matrix is Sparse or Not
There are numerous applications of matrices, both in mathematics and other sciences. Some of them merely take advantage of the compact representation of a set of numbers in a matrix. Few to mention the application of matrices are game theory, economics, graph theory, quantum theory, probabilty theory and statistics. Each type of application use different type of data. Design a generic class matrix with functions to check if a matrix is sparse and add two matrices. A matrix is said to be sparse, if the number of zero’s in the matrix is larger than the number of non-zero elements. Define a user defined exception mismatchDimension and throw it when the dimension of matrix1 is not equal to dimension of matrix 2. Print “Dimension of matrices do not match” when the exception is caught.

Input Format:

Number of rows in matrix1

Number of columns in matrix1

Element1 in matrix1

Element2 in matrix1

Elementn in matrix1

Number of rows in matrix2

Number of columns in matrix2

Element1 in matrix2

Element2 in matrix2

Elementn in matrix2

Output Format:

Print elements of resultant matrix or Dimension of matrices do not match if exception is caught

Element1 in resultant matrix

Element2 in resultant matrix

Elementn in resultant matrix

Matrix is sparse or Matrix is not sparse

Reply
Gobind - April 9, 2019

Today is the Last day
Please provide solution for this question:

Check if a Matrix is Sparse or Not
There are numerous applications of matrices, both in mathematics and other sciences. Some of them merely take advantage of the compact representation of a set of numbers in a matrix. Few to mention the application of matrices are game theory, economics, graph theory, quantum theory, probabilty theory and statistics. Each type of application use different type of data. Design a generic class matrix with functions to check if a matrix is sparse and add two matrices. A matrix is said to be sparse, if the number of zero’s in the matrix is larger than the number of non-zero elements. Define a user defined exception mismatchDimension and throw it when the dimension of matrix1 is not equal to dimension of matrix 2. Print “Dimension of matrices do not match” when the exception is caught.

Input Format:

Number of rows in matrix1

Number of columns in matrix1

Element1 in matrix1

Element2 in matrix1

Elementn in matrix1

Number of rows in matrix2

Number of columns in matrix2

Element1 in matrix2

Element2 in matrix2

Elementn in matrix2

Output Format:

Print elements of resultant matrix or Dimension of matrices do not match if exception is caught

Element1 in resultant matrix

Element2 in resultant matrix

Elementn in resultant matrix

Matrix is sparse or Matrix is not sparse

Reply
Tunga Bhavitha - February 5, 2020

I WANT CODES OF
1)RECURSIVE FIBONACCI
2)VERIFICATION OF CIRCULAR PRIME NUMBER
3)PLAYING CARDS
ALL OS CSE1002

Reply
Stranger - February 10, 2020

Distance finding(IPS3-448)

Reply
mohit - March 16, 2020

Need a answer for this question..

Write a C++ program to find the inverse of a square matrix using row operations. (Do not use recursion and co-factors). The program should work for a matrix of any dimension
Hint: Augment the matrix with an identity matrix of the same size and apply row operations.

Test Cases Input Structure:

4 (Dimension of the square matrix)

-1 1 1 1…………1 1 1 -1 (Elements of the matrix)

Reply
Shreya - March 27, 2020

Generic right shift

Reply
Srinjay - April 6, 2020

Best sales person
A company stores the name, age and sales made in five cities of their salespersons, given the details of ‘n’ employees, write an algorithm and the C program to find the best sales person. Best sales person is the one who has made maximum sales in the company. For example given the details of six salespersons with the following details:

SP1, 34, 45, 18, 22, 38, 37

SP2, 32, 46, 15, 23, 35, 29

SP3, 29, 47, 16, 30, 35, 35

SP4, 31, 49, 12, 32, 36, 40

SP5, 23, 45, 11, 30, 35, 39

SP6, 29, 41, 15, 31, 33, 37

Then the best salesperson is SP4.

Input Format

First line contains the number of salespersons, n

Next n lines contain the details of ‘n’ salespersons such as name, age and sales made by the salesperson in five cities separated by space

Output Format

Print the name of the best sales person

Reply
Blackadder - April 6, 2020

I am unable to find the program code
kindly update.

Tube and age
A game is conducted with ‘n’ players. Given the name, age and size of tube with each player and a player name ‘p’, write an algorithm and the C program to print name of all the players who can be partner of the player ‘p’. A player ‘q’ can be partner of player ‘p’ if the age of ‘q’ is less than player ‘p’ and tube size of player ‘q’ is greater than tube size of player ‘p’.

For example, given details of five salespersons as follows:

Name1, 34, 15

Name2, 23, 12

Name3, 45, 9

Name4, 19, 34

Name5, 32, 14

And player ‘p’ name as Name1. Name of players who can be partner of player ‘p’ are Name2, Name5.

Input Format

First line contains the number, n

Next n lines contain details of ‘n’ players such as name, age and size in order and separated by space

Next line contains the name of the player, p

Output Format

Print all the name of players with age less than age of player p and tube size less than tube size of player p

Reply
Sriganesh.N - June 4, 2020

Check if a matrix is sparse or not-cse1002
Amount remaining after shopping-cse1002
Tube and Age-cse1002
Function to convert Quadadecimal-cse1002

Pls upload these codes

Reply
shra - June 5, 2020

Please help with this 🙁
Amount remaining after shopping
Sherley goes for a shopping to a mall ‘M1’ . She uses credit card of bank ‘ABC’ for her purchases. Account details of each customer of ‘ABC’ contain Account holder name, Account number and Balance. Details of customers of mall ‘M1’ includes customer name and list of items purchased and cost of the items. Given the details of ‘n’ customers of bank ‘ABC’ and the purchase details of ‘m’ customers to mall ‘M1’, design an algorithm and write a C program to print the name of items purchased by Sherley and the balance amount in the account of Sherley in the bank ‘ABC’.

For example, if details (Name, Account number, Balance) of six customers of bank are given as follows:

Raju 12356 1000.00

Sam 12789 980.00

Ram 13457 975.50

Sherley 16789 1500.00

Sheela 17890 1345.50

Kamala 12378 2567.75

Details (Name, number of items purchased, item name1, cost1, item name2, cost2,…) of three customers of mall m1 are given as follows:

Ram 2 Bread 50.00 Jam 25.00

Sherley 3 Milk 20.00 Bread 50.00 Butter 31.50

Mukesh 4 Chocolate 15.00 Chips 12.50 Rice 29.00 Dall 31.25

Assume that the customer of mall has purchased only a maximum of ten items

Input Format

First line contains the number of customers of ABC bane, n

Next ‘n’ lines contain the details of customers of bank such as Account holder name, Account number and Balance in order and separated by space

Next line contains the number of customers to mall M1, m

Next ‘m’ lines contains the details of customers to mall such as name, number of items purchased ‘r’, 2*r detail such as item name and cost. Each detail is separated by a space

Output Format

Print name of the items purchased by Sherley, one item name in a line and balance amount in account of Sherley in the bank

Reply

Leave a Reply:

This site uses cookies and by using the site you are consenting to this.