Ceng198

Introduction to Computer Programming

Lab#4 - Grading Lab



Write a program that asks for the user to enter the number of sides of the shape, then according to the number entered, the program should ask the user to enter the following;



For 0 entered -> The user should only enter 1 value which will be the radius of a circle, and then the program will calculate the area and the perimeter of the circle and will print it out.



For 3 entered -> The user should enter the lengths of the sides of a triangle and the program should calculate the perimeter of the triangle and it should print it out.



For 4 entered -> The user should enter 2 values that correspond to the sides of a square or rectangle. Then the program should calculate the area and the perimeter of the square or rectangle and it should print it out on the screen.





Here is a sample run on how your program should be working;





When 0 is entered;



When 3 is entered;











When 4 is entered;