Showing posts with label if else statement. Show all posts
Showing posts with label if else statement. Show all posts

Monday, November 11, 2013

C++ Program That Prints the Insurance Fee to Pay for a Pet

Write a program that prints the insurance fee to pay for a pet according to the following rules:
1)A dog that has been neutered costs $40.
2)A dog that has not been neutered costs $50.
3)A cat that has been neutered costs $450.
4)A cat that has not been neutered costs $65.
5)A bird or reptile costs nothing.
6)Any other animal generates an error message.
The program should prompt the user for the appropriate information, using a code to determine the kind of animal (i.e. D or d represents a dog, C or c represents a cat, B or b represents a bird, R or r represents a reptile, and anything else represents some other kind of animal).
After printing the insurance fee, the program should ask the user if (s)he wants to insure another animal.

Saturday, November 9, 2013

C++ Program That Calculates the Obtained Marks and Determines The Division of Student

The marks obtained by a student in 5 different subjects are input through the keyboard. The student gets a division as per the following rules:
a. Percentage above or equal to 60 - First division
   b. Percentage between 50 and 59 - Second division
c. Percentage between 40 and 49 - Third division
d. Percentage less than 40 – Fail