Denominations - 3
Write a program to find the minimum number of notes required for the amount
The first line is a single integer
Given
M = 1543, it can be written as1543 = 3*(500) + 3*(50) + 0*(10) + 1*(3)Then the output should be
500: 3 50: 0 10: 4 1: 3
Denominations - 4
Write a program to find the minimum number of notes required for the amount
The first line is a single integer
Given
M = 2257 Then 2257 can be written as
2000 * 1 + 500 * 0 + 200 * 1 + 50 * 1 + 20 * 0 + 5 * 1 + 2 * 1 + 1 * 0So the output should be
2000:1 500:0 200:1 50:1 20:0 5:1 2:1 1:0.
Denominations - 2
The possible denominations of currency notes are 100, 50, 20 and 10. The amount
The first line of input is an integer A.
The output should be a string representing number of 100, 50, 20, 10 notes possible.
In the given example amount
370, it can be written as370 = 3*(100) + 1*(50) + 1*(20) + 0*(10)Then the output should be
Consider an array MARKS[20][5] which stores the marks obtained by 20 students in 5 subjects. Now write a program to
(a) find the average marks obtained in each subject.
(b) find the average marks obtained by every student.
(c) find the number of students who have scored below 50 in their average.
(d) display the scores obtained by every student.
IPL Match Details-
Write a program that reads all the match outcomes and summarizes the information of all the matches.
Points are given to the teams based on the outcome of the match.
A win earns a team 3 points. A draw earns 1. A loss earns 0.
The following information is expected:
MP: Matches Played
W: Matches Won
D: Matches Drawn (Tied)
L: Matches Lost
P: Points The team information should be displayed in descending order of points.
output1:
Team: RR, Matches Played: 3, Won: 2, Lost: 0, Draw: 1, Points: 7
Team: MI, Matches Played: 2, Won: 1, Lost: 0, Draw: 1, Points: 4
Team: DD, Matches Played: 3, Won: 0, Lost: 0, Draw: 3, Points: 3
Team: CSK, Matches Played: 2, Won: 0, Lost: 1, Draw: 1, Points: 1
Team: KKR, Matches Played: 2, Won: 0, Lost: 2, Draw: 0, Points: 0input1:
6
CSK;RR;loss
RR;DD;draw
MI;KKR;win
KKR;RR;loss
CSK;DD;draw
MI;DD;draw
WAP to create the classes as per the hierarchy shown below.Include the data members in the relevant classes to store the following information:-
Name, Id, No of matches played,No. of runs scored, No. of wickets taken.
Calculate the batting average and wickets per match for an all rounder player.Use parameterized constructor to initialize the object.
[ Batting average=No. of runs scored/No. of matches played
Wickets per match= No. Of wickets taken/ No. of matches played ]
WAP to Create a class ‘Book’. Derive two classes from it namely ‘’Print_Book’ and ‘E_Book’. Store the following details about the book in the relevant classes. Title, Author, Price, No of pages and Size in KB. Input information for ‘m’ number of print books and ‘n’ number of eBooks and display it.
Add two polynomials
Given two polynomials A and B, write a program that adds the given two polynomials A and B. Input:The first line contains a single integer M.
Next M lines contain two integers Pi, Ci separated with space, where Pi denotes power and Ci denotes co-efficient of Pi for polynomial A. After that next line contains a single integer N. Next N lines contain two integers Pj, Cj separated with space, where Pj denotes power and Cj denotes co-efficient of Pj for polynomial B.
input1:If M = 4 and for polynomial A
For power 0, co-efficient is 5
For power 1, co-efficient is 0
For power 2, co-efficient is 10
For power 3, co-efficient is 6.
If N = 3 and for polynomial B
For power 0, co-efficient is 1
For power 1, co-efficient is 2
For power 2, co-efficient is 4. outPut: addition of A and B is "6x^3 + 14x^2 + 2x + 6"
input2: output2:0
4
0 5
1 0
2 10
3 6
4
0 -5
1 0
2 -10
3 -6
WAP to create a class which stores a dynamic integer array and its size. Include all the constructors and destructor in the class. Store two arrays of different size in two objects. Join the two arrays and and store it in another object using a member function.
Complete the given code to get the output shown below:-
Base1
Base2
#include<iostream>
using namespace std;
class Base1 {
public:
void display()
{ cout << " Base1"<< endl; } };
class Base2 {
public:
void display()
{ cout << "Base2"<<endl"; } };
class Derived: public Base1, public Base2 {
public:
};
int main()
{
Derived d;
return 0;
}