0% found this document useful (0 votes)
19 views8 pages

SHUB

The document contains details of two programming assignments completed by Shubham Kumar. The first assignment involves writing a code to calculate the total cost of 60 book copies accounting for cover price, discount percentage, shipping costs for first and additional copies. The second assignment calculates the average age of males and females by taking birth year as input and finding the difference with the current year. Both problems include stating the aim, inputs, algorithm, flowchart, code written and sample outputs.

Uploaded by

Naveen Agarwal
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)
19 views8 pages

SHUB

The document contains details of two programming assignments completed by Shubham Kumar. The first assignment involves writing a code to calculate the total cost of 60 book copies accounting for cover price, discount percentage, shipping costs for first and additional copies. The second assignment calculates the average age of males and females by taking birth year as input and finding the difference with the current year. Both problems include stating the aim, inputs, algorithm, flowchart, code written and sample outputs.

Uploaded by

Naveen Agarwal
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/ 8

NAME: SHUBHAM KUMAR

CSE DEPARTMENT SECTION: SO8

ROLL NO:- 54 REGISTRATION NO:-


2310534

ASSIGNMENT 1
QUESTION :01
AIM/PROBLEM STATEMENT:-
TO FIND THE TOTAL COST FOR 60 COPIES GIVEN, THE COVER PRICE , DISCOUNT,
SHIPPING COST AND THE NUMBER OF COPIES.
A} THE INPUTS REQUIRED IN THE PROBLEM IS STATED BELOW:
X=COVER PRICE OF THE BOOK
Y=THE DISCOUNT PERCENTAGE
Z= SHIPPING COST FOR 1ST COPY
P= SHIPPING COST FOR THE ADDITIONAL COPY
B} THE TYPE OF STATEMENT USED IS SEQUENTIAL STATEMENT.
C} REFER THE SCANNED COPY OF ALGORITHM OF THE QUESTION ATTATCHED
BELOW………..
REFER THE BELOW SHEET FOR THE FLOWCHART OF THE ABHOVE QUESTION

D) THE CODE REQUIRED FOR THE FOLLOWING QUESTION IS TEXTED BELOW:-


#enter the price of a book

x=int(input("price of the books:"))

#enter the discount percentage

y=int(input("discount percentage:"))

#enter the shipping cost of first copy

z=int(input("shipping cost of first copy:"))

#enter the shipping cost for additional copy

p=int(input("shipping cost for additional copy"))

#price of the first copy


first_copy=x-(x*y/100)+z

#price of the additional copy

additional_copy=(x-(x*y/100)+p)*59

#display the wholesale cost of a single book

print("wholesale cost of the single book:",first_copy)

#display the wholesale cost of 60 copies

print("wholesale cost of 60 copies:",additional_copy)

THE MULTIPLE OUTPUT OF THE FOLLOWING CODE IS DISPLAYED BELOW:-


output 01

price of the books:100

discount percentage:10

shipping cost of first copy:20

shipping cost for additional copy18

wholesale cost of the single book: 110.0

wholesale cost of 60 copies: 6372.0

output 2

price of the books:200

discount percentage:15

shipping cost of first copy:40

shipping cost for additional copy35

wholesale cost of the single book: 210.0

wholesale cost of 60 copies: 12095.0


QUESTION NO 2:-
AIM /PROBLEM:-
TO FIND THE AVERAGE AGE OF THE MALE AND FEMALE IN A POPULATION OF X
PEOPLE WHOSE AGE CAN BE CALCULATED FROM BIRTHYEAR.

A)THE INPUT REQUIRED FOR THE FOLLOWING QUESTION IS GIVEN BELOW:-


MAN1= BIRTHYEAR OF MAN 1
MAN2= BIRTHYEAR OF MAN2
MAN3= BIRTHYEAR OF MAN3
FEMALE1= BIRTHYEAR OF FEMALE1
FEMALE2= BIRTHYEAR OF FEMALE2
FEMALE3= BIRTHYEAR OF FEMALE3

B) THE ALGORITHM OF THE QUESTION IS LISTED BELOW:-


THE FLOWCHART OF THE ABHOVE QUESTION IS DISPLAYED BELOW:-

C)THE PROGRAM TO COMPUTE THE AVERAGE AGE OF MALE AND FEMALE IS GIVEN
BELOW:-
#enter the birth year of man 1

man1=int(input("birthyear of man 1:"))

#enter the birth year of man 2

man2=int(input("birthyear of man 2:"))

#enter the birthyear of man 3


man3=int(input("birthyear of man 3:"))

#enter the birthyear of female 1

female1=int(input("birth year of female 1:"))

#enter the birthyear of female 2

female2=int(input("birthyear of female 2:"))

#enter the birthyear of female 3

female3=int(input("birthyear of female 3:"))

#enter the present year

c=int(input("present year:"))

#total number of males

x=3

#total number of females

y=3

#average age of male 1

average_male1=c-man1

#average age of man 2

average_man2=c-man2

#average age of man 2

average_man2=c-man2

#average age of man3

average_man3=c-man3
#average age of female 1

average_female3=c-female1

#average age of female 2

average_female2=c-female2

#average age of female 3

average_female3=c-female3

#display the average age of man

average_man=(man1+man2+man3)/x

#dsplay the average age of female

average_female=(female1+female2+female3)/y

#display the average age of male

print("average age of man:",average_man)

#display the average age of female

print("average age of female:",average_female)

MULTIPLE OUTPUT OF THE ABHOVE PROGRAM IS TEXTED BELOW:-


output 1

birthyear of man 1:1999

birthyear of man 2:1998

birthyear of man 3:1997

birth year of female 1:1996

birthyear of female 2:2001

birthyear of female 3:1999


present year:2023

average age of man: 1998.0

average age of female: 1998.6666666666667

output2

birthyear of man 1:2001

birthyear of man 2:2002

birthyear of man 3:2003

birth year of female 1:2004

birthyear of female 2:2003

birthyear of female 3:1998

present year:2023

average age of man: 2002.0

average age of female: 2001.6666666666667

LEARNING OUTCOMES:-
1) BY THIS PROGRAM WE HAVE LEARNT TO APPLY COMPUTATIONAL THINKING TO
DEVISE PROBLEM OF THE GIVEN SOLUTION.
2) WE ARE ABLE TO IDENTIFY THE TYPE OF STATEMENTS REWUIRED TO SOLVE THE
PROBLEMS.
3)WE LEARNT TO TAKETHE INPUT FROM THE USER AND DISPLAY IT.

You might also like