Input a string and check whether a particular character is present in it
Any year is input through the keyboard. Write a program to determine whether the year is a leap year or not.
Hint: Use the % (modulus) operator)
Write a C++ program to select Teaching Assistants (TAs). The program takes as input, the student’s cgpa and student’s gpa in programming course and checks whether the student is eligible for TA or not. A student is eligible for TA only if he/she has a CGPA above 3 and his/her GPA in programming course is also above 3. Otherwise he will not be offered any TA. For all those students, who satisfy the condition for eligibility of TA (cgpa and gpa is greater than 3), There are four types of TA, offered to a student according to following criteria.
a. Full time TA if he/she is student of MS.
b. Part time TA if he/she is student of BS.
The program inputs the type of degree in a variable of type char, where ‘M’ is for MS student and ‘B’ represents BS student. Incase user enters any letter other than M or S; the program should display INVALID INPUT.
Write a C++ program that displays water bills. The water rates vary depending on the type of usage.
A code of ‘H’ means home use,
A code of ‘C’ means commercial use,
A code of ‘I’ means industrial use.
Any other code value should be treated as an INVALID INPUT.
Water rates are computed as follows:
Code H: First 1 hundred gallons for $5.00 and $0.005 for each additional gallon used
Code C: First 4 hundred gallons for$1000.00 and $0.025 for each additional gallon used
Code I: First 4 hundred gallons for $1500 and $0.125 for each additional gallon used
Your program should prompt the user to enter:
An integer account number
A code in character
A real number representing the gallons of water consumed.
The output from your program should include the
An Insurance company follows following rules to calculate premium.
a) If a person’s health is excellent and the person is between 25 and 35 years of age and lives in a city and is a male then the premium is Rs. 4 per thousand and his policy amount cannot exceed Rs. 2 lakhs.
b) If a person satisfies all the above conditions except that the sex is female then the premium is Rs. 3 per thousand and her policy amount cannot exceed Rs. 1 lakh.
c) If a person’s health is poor and the person is between 25 and 35 years of age and lives in a village and is a male then the premium is Rs. 6 per thousand and his policy cannot exceed Rs. 10,000.
d) In all other cases the person is not insured.