0% found this document useful (0 votes)
23 views15 pages

Project 2022-23 Aditya

Uploaded by

mansi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views15 pages

Project 2022-23 Aditya

Uploaded by

mansi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

A project on

A Menu-driven program to find the


area or the perimeter of five
different shapes.

For the Academic year 2022-23


[As a part of Information Practices]
Submitted by
Aditya Gidde
roll no.1
Under the guidance of
Mrs. Mohini Varma
CERTIFICATE
SUNDARAM CENTRAL SCHOOL AND JUNIOR
COLLEGE
THIS IS TO CERTIFY THAT
ADITYA GIDDE
OF CLASS XI SCIENCE.
Has satisfactorily completed the project work in
Information Practices on the topic
“Menu-driven program to find the area or the
perimeter of five different shapes”
Prescribed by Central Board of Secondary
Education (CBSE) for the year 2022-2023 under the
guidance of the I.P faculty Mrs. Mohini Varma

PRINCIPAL INTERNAL EXAMINER

DATE.
SEAT NO.
ACKNOWLEDGMENT
I feel proud to present my project in
INFORMATICS PRACTICES on the topic “Menu-
driven program to find the area or the perimeter of
five different shapes”. This project wouldn't have
been feasible without the proper and rigorous
guidance of my English faculty Mrs. Mohini
Varma who guided me throughout this project
in every possible way. I would like to express
my gratitude to my colleagues for providing
the necessary information and knowledge
about the work during the period of my
project. I thank my parents for their
encouragement and support In my humble
venture. I am thankful to principal Dr. Sunil
Kumar Yadav, vice principal sir Mr. Sushil
Kumar Pandey, and all staff members of
Sundaram Central School and Junior College
for granting permission to carry out this
project.

Aditya Gidde
XI SCIENCE
ROLL NO.: 1
SUNDARAM CENTRAL SCHOOL
INDEX
Sr Title Page
no. No.

1 Certificate 1

2 Acknowledgment 2

3 Introduction 4

4 Coding 5

5 Output 8

6 Bibliography 14
INTRODUCTION

The project is based on the topic


where we have to make a program
that displays a menu of shapes, takes
the user desired shape, and then takes
the required measurements of that
entered shape; according to the choice
of the user, it will display the
computed result for the perimeter or
the area of that particular shape.

This program is done in python,


python is a high-level general-purpose
programming language. It is often
used to build websites and software to
automate tasks and conduct data
analysis. This project is done by using
various operators like if, else, loop,
and many more.
CODING
def main():
#select any of the 5 shapes
print("from the below given menu select any desired shape")
a=b=c=h=r=x=y=0
print("1. Rectangle")
print("2. Square")
print("3. Circle")
print("4. Triangle")
print("5. Parallelogram")
choice=int(input("enter your desired shape (1/2/3/4/5): "))
if choice==1: #rectange
print("a. Perimeter")
print("b. Area")
select=str(input("enter your choice (a or b) :"))
if select=="a":
x=float(input("enter length of the rectangle :"))
y=float(input("enter breadth of the rectangle :"))
perimeter=2*x+2*y
print("perimeter of rectangle is :",perimeter)
elif select=="b":
x=float(input("enter length of the rectangle :"))
y=float(input("enter breadth of the rectangle :"))
area=x*y
print("aera of rectangle is :",area)
else:
print("INVALID SELECTION")
elif choice==2: #square
print("a. Perimeter")
print("b. Area")
select=str(input("enter your choice (a or b) :"))
if select=="a":
x=float(input("enter the length of the side of the square :"))
perimeter=4*x
print("perimeter of the square is :",perimeter)
elif select=="b":
x=float(input("enter the length of the side of the square :"))
area=x*x
print("area of the square is :",area)
else:
print("INVALID SELECTION")
elif choice==3: #circle
print("a. Perimeter")
print("b. Area")
select=str(input("enter your choice (a or b) :"))
if select=="a":
r=float(input("enter the radius of the circle :"))
perimeter=2*3.14285*r
print("circumference of the circle is :",perimeter)
elif select=="b":
r=float(input("enter the radius of the circle :"))
area=3.14285*r*r
print("area of the circle is :",area)
else:
print("INVALID SELECTION")
elif choice==4: #triangle
print("a. Perimeter")
print("b. Area")
select=str(input("enter your choice (a or b) :"))
if select=="a":
x=float(input("enter length of first side of triangle :"))
y=float(input("enter length of second side of triangle :"))
c=float(input("enter length of third side of triangle :"))
perimeter=x+y+c
print("perimeter of the triangle is ",perimeter)
elif select=="b":
h=float(input("enter height of triangle :"))
x=float(input("enter length of base of triangle :"))
area=0.5*h*x
print("aera of triangle is :",area)
else:
print("INVALID SELECTION")
elif choice==5: #parallelogram
print("a. Perimeter")
print("b. Area")
select=str(input("enter your choice (a or b) :"))
if select=="a":
x=float(input("enter the length of base of the parallelogram :"))
y=float(input("enter the length of side of the parallelogram :"))
perimeter=2*x+2*y
print("perimeter of the parallelogram is :",perimeter)
elif select=="b":
x=float(input("enter the length of base of the parallelogram :"))
h=float(input("enter the height of parallelogram :"))
area=x*h
print("area of the parallelogram is :",area)
else:
print("INVALID SELECTION")
else:
print("INVALID SELECTION")
#quit the program or redo it
repeat=input("would you like to run again (yes or no) :").lower()
if repeat=="yes":
main()
else:
print("Thank you for running our program, Bye")
main() #end
OUTPUT
After running the program:

CASE 1:
After Entering: 1
#which is a rectangle,
#The result after entering 1, we have

The user is given a choice of whether the user wants a perimeter or an area.
After choosing: a
#which is the perimeter
#The result after entering “a”, we have

After choosing a. Perimeter, the program further asks for the length and the
breadth of the rectangle, and after providing it with the measurements it gave us
the perimeter in the output.
After choosing: b
#which is the area
#The result after entering “b”, we have

After choosing b. Area, the program further asks for the length and the breadth of
the rectangle, and after providing it with the measurements it gave us the
perimeter in the output.
After the result is met the program asks the user, “whether the user wants to
continue running the program or just end it.”
If the user enters: yes

The user is redirected to the start of the program, and the program can be run as
many times as the user wishes.
If the user enters: no

The program ends.

CASE 2:
After Entering: 2
#which is a Square,
#The result after entering 2, we have

The user is given a choice of whether the user wants a perimeter or an area.
After choosing: a
#which is the perimeter
#The result after entering “a”, we have

After choosing a. Perimeter, the program further asks for the length of the side of
the Square, and after providing it with the measurement it gave us the perimeter
in the output.
After choosing: b
#which is the area
#The result after entering “b”, we have

After choosing b. Area, the program further asks for the length of the side of the
square, and after providing it with the measurements it gave us the area in the
output.
After the result is met the program asks the user, “whether the user wants to
continue running the program or just end it.”(as shown in CASE 1)

CASE 3:
After Entering: 3
#which is a Circle,
#The result after entering 3, we have

The user is given a choice of whether the user wants a perimeter or an area.
After choosing: a
#which is the perimeter
#The result after entering “a”, we have

After choosing a. Perimeter, the program further asks for the radius of the circle,
and after providing it with the measurement it gave us the perimeter which is also
known as the circumference of the circle in the output.
After choosing: b
#which is the area
#The result after entering “b”, we have

After choosing b. Area, the program further asks for the radius of the circle, and
after providing it with the measurements it gave us the area in the output.
After the result is met the program asks the user, “whether the user wants to
continue running the program or just end it.”(as shown in CASE 1)

CASE 4:
After Entering: 4
#which is a Triangle,
#The result after entering 4, we have

The user is given a choice of whether the user wants a perimeter or an area.
After choosing: a
#which is the perimeter
#The result after entering “a”, we have
After choosing a. Perimeter, the program further asks for the length of the three
sides of the triangle, and after providing it with the measurement it gave us the
perimeter in the output.
After choosing: b
#which is the area
#The result after entering “b”, we have

After choosing b. Area, the program further asks for the height of the triangle and
the length of the base of the triangle, and after providing it with the
measurements it gave us the area in the output.
After the result is met the program asks the user, “whether the user wants to
continue running the program or just end it.”(as shown in CASE 1)

CASE 5:
After Entering: 5
#which is a Parallelogram,
#The result after entering 5, we have

The user is given a choice of whether the user wants a perimeter or an area.
After choosing: a
#which is the perimeter
#The result after entering “a”, we have
After choosing a. Perimeter, the program further asks for the length of the side
and base of the parallelogram, and after providing it with the measurement it
gave us the perimeter in the output.
After choosing: b
#which is the area
#The result after entering “b”, we have

After choosing b. Area, the program further asks for the height of the
parallelogram and length of a parallelogram, and after providing it with the
measurements it gave us the area in the output.
After the result is met the program asks the user, “whether the user wants to
continue running the program or just end it.”(as shown in CASE 1)
BIBLIOGRAPHY

• BOOK:
Informatics Practices – Sumita Arora

• https://youtu.be/2UxPGUu39Rw

You might also like