0% found this document useful (0 votes)
12 views

Assignment

Uploaded by

viivaanbedada
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Assignment

Uploaded by

viivaanbedada
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment

1. Write a simple c++ program that calculates the area of any triangle using Heron’s area formula.
Hint: Heron’s area formula A=√s(s − a)(s − b)(s − c)
a+b+c
Where s = and a, b, and c are the sides of any triangle.
2
The program is expected to ask the user to enter the measure of the three sides of a triangle and
display the result to the user in a user-friendly manner.
The mechanism of taking input from user
• Enter the first side of the triangle: shall be entered by user
• Enter the second side of the triangle: shall be entered by user
• Enter the third side of the triangle: shall be entered by user
Expected Output:
The area of the triangle is: the output calculated by the program
2. Write a c++ program that calculate and display the total amount and the earned interest by a
bank client for a certain amount of principal deposited in a bank. The program is expected
should interactive and take the required parameters from the user and should display the result
to the console in a user-friendly manner.
R
Hint: A=P ∗ (1 + 100)T
A = amount, P = principal, R = rate, T = time in year
The program is expected to take the following parameters from the user in the following manner
Mechanism of taking input from user:
▪ Enter the principal: shall be entered by user
▪ Enter the Annual Rate of interest: shall be entered by user
▪ Enter the amount of time the principal is deposited in years: shall be entered by user
Expected Output:
The total amount of the deposit is: the output calculated by the program
The net interest of the deposit is: the output calculated by the program
Note: the result of the calculation shall have a maximum of two-digit precision i.e., it should be
like “the net interest of the deposit is: 1234.97 birr”. To make the display more attractive it is
expected to use the I/O manipulator of c++.
3. Write a c++ program that implements a console-based calculator. The program shall prompt the
user what kind of calculation he/she wants to perform and prints the result to the computer screen.
The program is expected to have the following functionalities:
a. Addition of two numbers
b. Subtraction of two numbers
c. Multiplication of two numbers
d. Division of two numbers
e. The program is expected to display the sine, cosine, tangent, secant, cosecant and cotangent
of a number entered by user.
f. The base ten logarithm and the natural logarithm of a number.

1
The features of the program:
• The program shall be user friendly and interactive.
• The program display shall be well formatted.
• The program shall be implemented using switch statements
• The program shall be reliable and error free i.e., the program shall display the appropriate error
message if the user fails to enter the appropriate input. For example, for division operation, if the
denominator is zero, the program shall prompt the appropriate error message.
4. write a c++ program that can give the following information of your closed friends’ name, id,
section and their expected grade. (take your fiends are w,x,y and z, id: ugr/0351/14, ugr/0352/14,
ugr/0353/14 and ugr/0354/14, section: 4,5,4, and 5, grade: A+,B+,A and B respectively).
(use your group members’ Name, ID and your section in place of w,x,y and z id: ugr/0351/14,
ugr/0352/14, ugr/0353/14 and ugr/0354/14)
Hint: The output must be printed in table form

5. Write a simple c++ program that displays the following patterns at the console

(a) (b)

→ Submit in softcopy and hardcopy


→ Submission date 23/10/2024
→ Do in group of Eight

You might also like