Input a string and check whether a particular character is present in it

Recommended Answers

All 6 Replies

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)

  1. Assume that a video store employee works 50 hours. He is paid accordingly:
    $4.50 for the first 40 hours
    1.5 times the regular pay rate for the first five hours over 40
    Double‐time pay for all hours over 45
    After calculating the basic pay according to the above details, 28 percent tax is also deducted from his salary. After deducting the tax from Basic pay we get the Net Pay. Write a program that prints his Basic Pay, Tax, and Net pay on the screen. Label each amount with appropriate titles and add appropriate comments in the program

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
 Account

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.