The science museum has asked you to write a c++ application that children can use to find the total number of hours and years slept during their lifetime. Assume they slept at an average of 8 hour per night. The user should enter the name, birthday, year and current year.
Name - Mercy
day - 01
year - 1999
Current year - 2021
To calculate the number of hours slept. Assume 365 day per year, 30 day per month and 8 hours of sleep per day. The program should show how many years, month, weeks, days, hours, minutes, seconds the child slept in this lifetime.
Note : use classes, function, and control structures to achieve this task. the user will also determine the number of children the process.
Consider two classes to store the names of people. Class NAME will store the name in upper case and Class name will store in lower case. Write a program to convert the uppercase name to a lowercase name.
Given a list of unsorted integers, find the pair of elements that have the smallest absolute difference between them. If there are multiple pairs, find them all.
Input Format
The first line contains a single integer , the length of the list.
The second line contains space-separated integers, .
Output Format
Output the pairs of elements with the smallest difference. If there are multiple pairs, Output any one of them.
Sample Input 0
10
-20 -3916237 -357920 -3620601 7374819 -7330761 30 6246457 -6461594 266854
Sample Output 0
-20 30
Explanation 0
(30) - (-20) = 50, which is the smallest difference.
Sample Input 1
12
-20 -3916237 -357920 -3620601 7374819 -7330761 30 6246457 -6461594 266854 -520 -470
Sample Output 1
-520 -470
Explanation 1
(-470) - (-520) = 30 - (-20) = 50, which is the smallest difference. Only the first pair is given as output.
Sample Input 2
4
5 4 3 2
Sample Output 2
2 3
Write a program using an overloaded function(s) named convert() that work as given below:
i. public void convert(int seconds)
This function converts and displays number of seconds to hour, minutes and seconds
ii. public void convert(double days)
This function converts and displays number of days to years, months and days
Call the above functions from main.
the science museum has asked you to write a c++ application that children can use to find the total number of hours and years slept during their lifetime. assume they slept at an average of 8 hour per night. the user should enter the name, birthday, year and current year. to calculate the number of hours slept. 365 day per year, 30 day per month and 8 hours of sleep per day. the program should show how many years, month, weeks, days, hours, minutes, seconds the child slept in this lifetime. note use classes, function, and control structures to achieve this task. the user will also determine the number of children the process
The MUSEUM has asked you to write a C++ applicationt that children can use to find the total number of hours and years slept during their lifetime. Assume they slept at an average of 8 hour per night. the user should enter the name, birthday, year and current year. To calculate the number of hours slept. 365 day per year, 30 day per month and 8 hours of sleep per day. The program should show how many years, month, weeks, days, hours, minutes, seconds the child slept in this lifetime
Area of Rectangle
Given an MxN matrix filled with
X's and O's, find the largest rectangle containing only X's and return its area. If there are no Xs in the entire matrix print 0.
Input
The first line of input will be containing two space-separated integers, denoting M and N.
The next M lines will contain N space-separated integers, denoting the elements of the matrix.
Output
The output should be a single line containing the area of the maximum rectangle.
Explanation
For example, if the given M, N and elements of matrix are as the following
4 5
X O X O O
X O X X X
X X X X X
X O O X O
The matrix from indices (1, 2) to (2, 4) has the maximum rectangle with
X. So the output should be the area of the maximum rectangle with X, which is 6.
Sample Input 1
4 5
X O X O O
X O X X X
X X X X X
X O O X O
Sample Output 1
6
Sample Input 2
3 3
O X X
O X X
O O O
Sample Output 2
4Rotate Words In Sentence
Given a sentence and an integer N, write a program to rotate letters of the sentence among the words without changing the length of those words and positions of the spaces.
Input
The first line of input will be a sentence.
The second line of input will be an integer N.
Output
The output should be a single line containing the sentence by rotating the letters among the words without changing the length of the words and positions of the spaces.
Explanation
For example, if the given sentence and N are
Welcome to your first problem
5
Rotate the sentence 5 letters towards right side without changing the length of the words and position of spaces in the original sentence.
So the output should be
oblemWe lc omet oyour firstpr
Sample Input 1
Welcome to your first problem
5
Sample Output 1
oblemWe lc omet oyour firstpr
Sample Input 2
All the best
2
Sample Output 2
stA llt hebe