How to code “ (5 times the number n) added to 16 “
Weekends
Given two dates D1 and D2, write a program to count the number of Saturdays and Sundays from D1 to D2 (including D1 and D2).
The date in string format is like "8 Feb 2021".Input
The first line of input will contain date D1 in the string format.
The second line of input will contain date D2 in the string format.Output
The output should be a single line containing two integers separated by space
Explanation
For example, if the given dates are "25 Jan 2021" and "14 Feb 2021", the Saturdays and Sundays dates from "25 Jan 2021" to "14 Feb 2021" are
"30 Jan 2021" is a Saturday
"31 Jan 2021" is a Sunday
"6 Feb 2021" is a Saturday
"7 Feb 2021" is a Sunday
"13 Feb 2021" is a Saturday
So the output should be
Saturday: 3
Sunday: 3
Sample Input 1
25 Jan 2021
14 Feb 2021
Sample Output 1
Saturday: 3
Sunday: 3
Sample Input 2
25 May 2019
22 Dec 2021
Sample Output 2
Saturday: 135
Sunday: 135
Write a C++ program to create a class bank to deposit an amount,withdraw an amount,balance amount using multiple object.
Craete a class cylinder with radius and height as data member and perform the addition of two cylinders using constructor overloading.
PS using friend function
Create a class Cuboid1,Cuboid2 with below properties:
Display the cuboid 3 with the difference between cuboid1 and cuboid2 and print the volume of cuboid 3.Write a C++ program using friend function
#include <iostream>
Write a program for carpeting a rectangular room.
Create a class named Dimension that has three fields:
· one for the length of the room
· one for the width of the room
It also has a parameterized constructor to set the values of length and width with user-defined values and set area to zero.
Next create a class Carpet that is friend class of the Dimension class. It should have a field for the cost of the carpet per square foot and a parameterized constructor to set its value. The Carpet class should also have a method that calculates the area of the carpet (l*w) and then calculate the cost of carpeting the room by multiplying cost per sq foot with area. It will also return total cost of carpeting the room.
In main(), create instance of Dimension and set values. Then calculate and display total cost of carpeting the room through Carpet class object.
What will be the for loop of this code? and can you tell a little description of the process by mentioning what does index and len mean here! Thank you.
def f3(word, letter):
index = 0
while index < len(word):
if word[index] == letter:
return index
index = index + 1
return -1
print(f3("processing", "s"))
print(f3("processing", "z"))
Explain in detail about the OOPs concepts in C++ with suitable examples
What is the purpose of constructors in c++.? How to denote the destructors in c++?
Give the order of execution of the constructors and destructors in a multilevel inheritance. Explain the same with a suitable program .