Está en la página 1de 4

Machine Problems: Decision Making and Branching

Deadline: August 8, 2012


Guidelines:
1. Use proper naming convention for the file name of the program (i.e. fmp01,
fmp02, and so on).
2. Put the comment below on the top part of the program:
/*
FMP No. __: This program will put the problem description here .
Created by: ____________
ID Number: ____________
Date Created:___________
*/
Source code here:
# include<stdio.h>
# include<iostream>
using namespace std;
int main()
{
..
//lines of codes
system (pause>0);
}

1. While purchasing certain items, a discount of 10% is offered if the quantity


purchased is more than 1000. If quantity and price per item are input through the
keyboard, write a program to calculate the total expenses.
2. The current year and the year in which the employee joined the organization are
entered through the keyboard. If the number of years for which the employee
has served the organization is greater than 3 then a bonus of Rs.2500/- is given
to the employee. If the years of service are not greater than 3, then the program
should not do anything.
3. A company insures its drivers in the following cases:
If the driver is married
If the driver is unmarried, male & above 30 years of age.
If the driver is unmarried, female & above 25 years of age.
In all other cases the driver is not insured. If the marital status, sex and age of
the driver are the inputs, write a program to determine whether the driver is to be
insured or not.
4. Write a program to calculate the salary as per the following table:
Gender Years
Male
>=10
>=10
<10
<10
Female >=10
>=10
<10
<10

Qualifications
Post-Graduate
Graduate
Post-Graduate
Graduate
Post-Graduate
Graduate
Post-Graduate
Graduate

Salary
15000
10000
10000
7000
12000
9000
10000
6000

5. Write a program to find the roots of a quadratic equation for all cases.
d>0 The two roots are real
d=0 Roots are equal and real
d<0 Roots are imaginary
6. Display three numbers in ascending order using if-else statement.

7. If cost price and selling price of an item is input through the keyboard, write a
program to determine whether the seller has made profit or incurred loss. Also
determine how much profit he made or loss he incurred.
8. If a five-digit number is input through the keyboard, write a program to obtain the
reversed number and to determine whether the original and reversed numbers
are equal or not.
9. Any character is entered through the keyboard; write a program to determine
whether the character entered is a capital letter, a small case letter, a digit or a
special symbol.
10. Write a program to calculate income tax of an employee. If the income is up to
60,000 pesos, then tax is zero. If the income is up to 80,000 pesos then the tax is
15% of the amount that is greater than 60,000 pesos. If the income is up to
80,000 pesos then the tax is 20% of the amount that is greater than 60,000
pesos.
11. Write a program to determine in which of the four quadrants an angle lies where.
0 <= angle <=360 degrees.
12. Calculate electric bill depending the following conditions
Consumption Units
0.200
201.400
401.600
601 and above

Rate of Charge
Rs. 0.50 per unit
Rs. 100 plus Rs.0.65 per unit excess of 200
Rs. 230 plus Rs.0.80 per unit excess of 400
Rs. 390 plus Rs.1.00 per unit excess of 600

13. Write a menu driven program which has following options:


a. Factorial of a number
b. Prime or not
c. Odd or even
14. Read x and compute Y = 1 for x > 0
Y = 0 for x = 0

Y = -1 for x < 0
15. A cloth show room has announced the following seasonal discounts on purchase
of items.
PURCHASE
AMOUNT
1-100
101-200
201-300
Above 300

Discount (Percentage)
Mill Cloth Handloom Cloth
__
5.0
5.0
7.5
7.5
10.0
10.0
15.0

Write a C program using switch and if statements to complete the net amount to be
paid by a customer.

También podría gustarte