Programs · Program 7-1
Q.Program 7-1: Program to calculate the payable amount for the tent.
Tamil Nadu DgeTextbookSubjective· 3mImportance★★★★★est
3% · 1/40 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →Program 7-1 is the chapter's opening example solved without functions: compute the tent's canvas area (curved surface of a cylinder + curved surface of a cone), multiply by the price per square metre, add 18% GST, and print the payable amount.
The idea. The tent in this example is a cylindrical base surmounted by a conical top. The canvas needed is the two curved surfaces:
CSA of cylinder = 2 * pi * r * h
CSA of cone = pi * r * l (l = slant height)
payable amount = canvas area * unit price + 18% GST
Written as straight-line code (this is the "before" picture — Program 7-2 will restructure exactly this logic with user-defined functions):
# Program 7-1: payable amount for the tent (without functions)
PI = 3.14
h = float(input("Enter height of the cylindrical part (in m): "))
r = float(input("Enter radius of the tent (in m): "))
csa_cylinder = 2 * PI * r * h
l = float(input("Enter slant height of the conical part (in m): "))
csa_cone = PI * r * l
canvas_area = csa_cylinder + csa_cone
print("Area of canvas needed:", round(canvas_area, 2), "sq m")
unit_price = float(input("Enter cost of 1 sq m of canvas (Rs.): "))
net_cost = canvas_area * unit_price
print("Cost of canvas : Rs.", round(net_cost, 2))
gst = 0.18 * net_cost
payable = net_cost + gst
print("Payable amount (incl. 18% GST): Rs.", round(payable, 2))
Expected output — sample run (h = 4 m, r = 7 m, l = 3 m, canvas at Rs. 120 per sq m):
Enter height of the cylindrical part (in m): 4
Enter radius of the tent (in m): 7
Enter slant height of the conical part (in m): 3
Area of canvas needed: 241.78 sq m …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.