Try Solving These Questions
More Coming Soon !!
Q7 .(a) Write a program to input the number of a week and print the corresponding day. Assume 1 for Monday, 7 for Sunday, etc. also give the proper message for the wrong number input.
(b). Write a program to enter the name and convert its each lower case letters to uppercase and vice versa.
Example : Input - Subhash Chandra Bose
Output- sUBHASH cHANDRA bOSE
Q8. Write a program to input a sentence. Create a function convert(int n), where n is an integer value in positive or negative. This function is used to encode or decode the given string by shifting each character of a string the number of times as specified by user.
Ex.- Input- Good Boy
Shift value –3
Output – Jrrg Erb
You can see that this function does not affect the spaces. Also if it reaches end of the alphabet list it starts the list again.(see the state of ‘y’ in “Boy” above, it changes to ‘b’). in the similar manner if the entered shift value of n is in negative then all the characters in a string will shift backwards.
Q9. The distance between two cities is measured in Kilometers(km) and Meters(m). Thus to add distance of two cities from the current city we need to add its km and m of one city with the km and m of other city. You must remember that 1000 meters makes one(1) Kilometer. Write a class with the following data members to add the distance of two cities from the current city.:
Class name : distance
Integer : km ,m
Distance Run(distance,distance) : to input two distances and to add them into the third
Display : to display the total distance.
Display the constructor required to initialize the objects.
Q10. Write a program to create a double dimensional array[4*4] to store 16 elements and to perform the following operations as per user choice-
1. To print the position of largest and least element
2. To print the sum of its diagonal elements
3. To print the sum of all the elements.
Q11. Design a class named “Database”. It has name, address, city, pin code and basic salary as data members. it also has member functions to input data, print data and calculate Dearness allowance which is 150% of basic salary, House rent which is 40% of basic salary and gross salary which is sum of basic, D.A. and H.R.A. A parameterized constructor is used to pass initial values to arguments by implicit call method.
Define the class “ Database”. Also create an object of the class.
Q12. Write a program to initialize an array of 5 names and initialize another array with their respective telephone numbers. Search for a name input by the user, in the list. If found, display “Search Successful” and print the name along with the telephone number, otherwise display “Search unsuccessful. Name not listed”.