Assignment 1 SE

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

Name: Jyoti Dixit

SID: 21103013
Software Engineering
ASSIGNMENT 1

Write the program code and test the test cases for the following questions.
Done on VSCode IDE
1. Write a program that accepts the three sides of a triangle and decides which
type of triangle the sides will make. Also, list and check the various test cases for
the same.
The following test cases are included in the code:
 Test case 1: Check that only three sides are entered by the user not more than three or less
than three side lengths are given as input by the user.
- for this, the input function is used to limit the user input to three inputs.
 Test case 2: The program will accept only the positive side for checking the triangle validity.
- In this program, we use do-while loops to ensure the user inputs positive side lengths.
If any negative or zero value is entered, the program will keep prompting for a valid
input.
 Test case 3: The Inequality theorem is used to check whether a triangle is forming or not.
- Once valid side lengths are provided, it checks if they form a valid triangle using the
triangle inequality theorem and then determines the type of triangle.
- i) whether the triangle is scalene i.e. all sides are unequal.
- ii) whether the triangle is isosceles i.e. 2 of the 3 sides are equal.
- iii) whether a triangle is equilateral i.e. all the sides are equal.
- iv) The triangle is not possible as it does not obey the inequality theorem.
Total test cases:
- In Test case 1: 1 test case used for taking 3 inputs.
- In Test case 2: 1 test case used for checking each side.
- In Test case 3: for each type of triangle from the 3 general length-based triangle
inequality theorem is applied, so 3 test cases were generated for each type of
triangle.
Total Test Cases: 1 +1+(3+1) = 6 Test case.
2. Write a program that accepts the coefficients of a quadratic equation and
calculates the roots of the equation. Also, list and check the various test cases for
the same.
Test cases are written in the screenshots provided above. There are in total of 3
Test cases used.
The coefficients a,b and c can be negative also.

You might also like