You are on page 1of 2

Programming Fundamentals BEE 2A, 2B

Assignment 01
CLO 2
Total Marks: 10 marks

Due Date: 16th April 2021

Tools: Microsoft Visual Studio 2010 or higher, Microsoft Visio (optional)

Instructions:

 All tasks must contain algorithm, flow charts, C++ coding, comments and all varieties of outputs.
 Assignments to be submitted on both hardcopy and softcopy. Softcopy is to be uploaded on LMS,
while hardcopy must be done handwritten on A4 pages, and submit it in a proper file.
 Assignment after due date will not be accepted.
 Assignment will not be returned back.

1. Structure of a program
A. Write a program that displays your favourite poem/verse/stanza. Use an appropriate escape
sequence for the line breaks.

2. Variable and data types


A. Write a program using different datatypes; that displays the Area of Circle, square and triangle.

B. Write a program using different datatypes that convert Pakistani Rupees into US dollars and UAE
Darham
■ 1 US $ = 152.3 PKR
■ 1 AED = 41.46 PKR

C. Write a program takes radius, length, base and height as inputs from the user and displays the Area
of Circle, square and triangle

D. Write a program that asks user to input the PKR amount and then convert and display it into US
dollars and UAE Darham
■ 1 US $ = 152.3 PKR
■ 1 AED = 41.46 PKR

3. Constant and Operators


A. Print square, cube and average of three numbers provided by the user
B. Prompt the user to enter radius and height of cone and display the volume of cone. Value of PI
should be declared using const qualifier.
C. Take five marks as input from user and print total marks and percentage.
D. Take three digits number from user and print sum of digits.
E. Take five digits number from user and print it in reverse order. (Hint: modulo (%) operator)

Assignment 01 Page 1 of 2 Instructor: Engr. Bushra Aijaz


Programming Fundamentals BEE 2A, 2B

4. Decisions
A. Write a temperature-conversion program, that gives the user the option of converting Fahrenheit
to Celsius or Celsius to Fahrenheit. Then carry out the conversion. Use floating-point numbers.
Option should be taken as Character input.
B. Discount of 20% is offered if quantity of item purchased is more than 50. Quantity and price of
item are taken as input from user. Write a program to calculate the cost of items. Use if-else for
“discounted” or “no discount” messages.
C. An automatic waiter is installed in a restaurant that serves the complementary coffee to all the
tables along its path. The automatic waiter has three sensors (S1, S2, S3) attached at its bottom to
sense the path and takes decision whether to turn left or right or move straight or stop. Program
the waiter that makes it able to take decisions as per the paths defined, and successfully reaches to
its destination.
D. Input the percentage of student and display his/her grade Using chain if-else structure.
E. (a) Write a program that takes alphabet as an input from user and display the message, if it is
Vowel or Consonant.
(b) Also indicate if the letter entered is Capital or Small?
F. Calculate discriminant with conditions of real or equal or imaginary roots.
(D == 0, equal roots), (D>0,real roots) and (D<0, imaginary roots).
G. Create the equivalent of a four-function calculator. The program should ask the user to enter a
number, an operator, and another number. (Use floating point.) It should then carry out the
specified arithmetical operation: adding, subtracting, multiplying, or dividing the two numbers.
Use a switch statement to select the operation. Finally, display the result.
H. Ask the student to enter lecture number (1-4) and show the list of Exercises using switch statement.
If the user enters any lecture other than 1-4, display an appropriate message.

Complex Engineering Task


A customer after done with all groceries queued into the billing line. The Counter boy has barcode reader
that makes the list of purchasing item on the screen. The cash paid by customer and total purchasing is
entered by the counter boy.

Write a program that generates the interactive output console to the counter boy; Looking at which he can
easily know the quantity of notes needed to return to the customer. For Example two notes of 1000, three
notes of 100 and so on.

Use modulo operator to keep the remainders. User list of variables. Use escape sequences to make the
output interactive. Use setw manipulator to set width.

Good Lcuk 

Assignment 01 Page 2 of 2 Instructor: Engr. Bushra Aijaz

You might also like