Computer Science, asked by shantannu2003, 1 year ago

I will mark the person brainlist who answer the question
WAP to input the type of department(cloth/electronices) and amount and print discount ,amount payable , purchase amount
purchase amount discoun oncloth
upto 2500 2%
2501 to 5000 3%
5001 to 7500 3.5%
more than 7500 4%
amount dis on electronics
upto 2500 3%
2501 to 5000 4%
5001 to 7500 6%
mare than 7500 8%

output should be like this:
enter type of department
cloth
enter purchase amount
1000
purcahse amount =Rs1000
discount=Rs20
amount payable=Rs 980

Remember:
If you input any other departmebt except for cloth/electronics output should be invalid department only​

Answers

Answered by rakeshchennupati143
1

dept = ["cloth","electronics"]

print("Enter Type Of Department:")

temp_dept = input()

print("Enter Purchase Amount")

temp_pur = int(input())

print("Purchased Amount is")

print(temp_pur)

temp_disc = 0

if temp_dept == dept[0]:

   if temp_pur < 2500 and temp_pur != 0:

       temp_disc = (2/100) * temp_pur

   elif temp_pur > 2500 and temp_pur < 5000:

       temp_disc = (3/100) * temp_pur

   elif temp_pur > 2500 and temp_pur < 5000:

       temp_disc = (3.5/100) * temp_pur

   elif temp_pur > 7500:

       temp_disc = (4/100) * temp_pur

   else:

       print("Purchase Amout Should Not Be 0")

   print("Discount")

   print(temp_disc)

   print("amount payable")

   print(temp_pur - temp_disc)

elif temp_dept == dept[1]:

   if temp_pur < 2500 and temp_pur != 0:

       temp_disc = (3/100) * temp_pur

   elif temp_pur > 2500 and temp_pur < 5000:

       temp_disc = (4/100) * temp_pur

   elif temp_pur > 2500 and temp_pur < 5000:

       temp_disc = (6/100) * temp_pur

   elif temp_pur > 7500:

       temp_disc = (8/100) * temp_pur

   else:

       print("Purchase Amout Should Not Be 0")

   print("Discount")

   print(temp_disc)

   print("amount payable")

   print(temp_pur - temp_disc)

else:

   print("Invalid Department.")

NOTE: you did not mentioned the language so i used python 3 to write the program

Hope you will mark this as Brainliest

Attachments:

shantannu2003: please tell the answer in java language
rakeshchennupati143: you have to mention it before you ask
rakeshchennupati143: now how can i answer i cant edit
rakeshchennupati143: delete my answer then i will write it again in java
Similar questions