Programming Exercises: Time, Pizza, and Geometry Calculations, Exams of Nursing

A series of programming exercises focused on basic calculations and conversions. The exercises cover topics such as converting time to seconds, calculating pizza needs for a party, determining the hypotenuse of a right triangle, finding the area of a triangle using heron's formula, calculating pizza order costs with sales tax, finding the square root of a number, and determining the volume and area of a cylinder. Additionally, there's a warm-up exercise involving user input and type conversion. These exercises are designed to help students practice fundamental programming concepts and mathematical calculations. A practical application of programming skills in everyday scenarios, enhancing understanding and problem-solving abilities.

Typology: Exams

2025/2026

Available from 10/20/2025

davian-Willis
davian-Willis 🇺🇸

4.7

(3)

4.4K documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
VF/
nput,
VFand
rather
VFthan
ime VFin
umber VF
of
VFeople
s VFlegs
VF(sides
you VFknow
VFthe VFngle
VFas VFinput,
mber VFof
VFpizzas
1.22.1 VFLab: VFConvert VFto VFSeconds
Write VFa VFprogram VFthat VFreads VFin VFhours, VFminutes, VFand VFseconds
VFas VFi VFoutputs VFthe VFtime VFin VFseconds VFonly.:
2.22.2 VFLab: VFConvert VFfrom VFSeconds
People VFfind VFit VFeasier VFto VFread VFtime VFin VFhours, VFminutes, VFand
VFseconds VFjust VFseconds.
Write VFa VFprogram VFthat VFreads VFin VFseconds VFas VFinput VFand
VFoutputs VFthe VFt VFminutes, VFand VFseconds.:
3.22.3 VFLab: VFPizza VFParty
Given VFthe VFnumber VFof VFpeople VFattending VFa VFpizza VFparty,
VFoutput VFthe VFn VFneeded VFpizzas VFand VFtotal VFcost. VFFor VFthe
VFcalculation, VFassume VFthat VFp VFslices VFon VFaverage VFand VFeach
VFpizza VFhas VF12 VFslices VFand VFcosts VF$14.95.:
4.22.4 VFLab: VFHypotenuse
Given VFtwo VFnumbers VFthat VFrepresent VFthe VFlengths VFof VFa
VFright VFtriangle' VFadjacent VFto VFthe VFright VFangle), VFoutput VFthe
VFlength VFof VFthe VFthird VFside VF(i.e. VFwith VFtwo VFdigits VFafter VFthe
VFdecimal VFpoint.:
5.22.5 VFLab: VFArea VFof VFa VFTriangle
Using VFHeron's VFformula, VFyou VFcan VFcalculate VFthe VFarea VFof VFa
VFtriangle VFif VFlengths VFof VFall VFthree VFsides. VFGiven VFthe VFlength
VFof VFeach VFside VFof VFa VFtria VFcalculate VFthe VFarea VFof VFthe
VFtriangle VFusing VFHeron's VFformula VFas VFfollow VFs VF= VFhalf VFof
VFthe VFtriangle's VFperimeter
area VF= VFthe VFsquare VFroot VFof VFs(s-a)(s-b)(s-c), VFwhere VFa, VFb, VFand VFc VFare
VFeach VFsides VFof VFthe VFtriangle.:
6.22.6 VFOrdering VFPizza
A VFlocal VFpizza VFshop VFis VFselling VFa VFlarge VFpizza VFfor VF$9.99.
VFGiven VFthe VFnu VFto VForder VFas VFinput, VFoutput VFthe VFsubtotal VFfor
VFthe VFpizzas, VFand VFthen VFou VFafter VFapplying VFa VFsales VFtax VFof
VF6%:
7.22.7 VFLAB: VFSquare VFroot
pf3

Partial preview of the text

Download Programming Exercises: Time, Pizza, and Geometry Calculations and more Exams Nursing in PDF only on Docsity!

1 nput, VFand rather VFthan ime VFin umber VFof VFeople s VFlegs VF(sides you VFknow VFthe VFngle VFas VFinput, mber VFof VFpizzas 1.22.1 VFLab: VFConvert VFto VFSeconds Write VFa VFprogram VFthat VFreads VFin VFhours, VFminutes, VFand VFseconds VFas VFi VFoutputs VFthe VFtime VFin VFseconds VFonly.: 2.22.2 VFLab: VFConvert VFfrom VFSeconds People VFfind VFit VFeasier VFto VFread VFtime VFin VFhours, VFminutes, VFand VFseconds VFjust VFseconds. Write VFa VFprogram VFthat VFreads VFin VFseconds VFas VFinput VFand VFoutputs VFthe VFt VFminutes, VFand VFseconds.: 3.22.3 VFLab: VFPizza VFParty Given VFthe VFnumber VFof VFpeople VFattending VFa VFpizza VFparty, VFoutput VFthe VFn VFneeded VFpizzas VFand VFtotal VFcost. VFFor VFthe VFcalculation, VFassume VFthat VFp VFslices VFon VFaverage VFand VFeach VFpizza VFhas VF 12 VFslices VFand VFcosts VF$14.95.: 4.22.4 VFLab: VFHypotenuse Given VFtwo VFnumbers VFthat VFrepresent VFthe VFlengths VFof VFa VFright VFtriangle' VFadjacent VFto VFthe VFright VFangle), VFoutput VFthe VFlength VFof VFthe VFthird VFside VF(i.e. VFwith VFtwo VFdigits VFafter VFthe VFdecimal VFpoint.: 5.22.5 VFLab: VFArea VFof VFa VFTriangle Using VFHeron's VFformula, VFyou VFcan VFcalculate VFthe VFarea VFof VFa VFtriangle VFif VFlengths VFof VFall VFthree VFsides. VFGiven VFthe VFlength VFof VFeach VFside VFof VFa VFtria VFcalculate VFthe VFarea VFof VFthe VFtriangle VFusing VFHeron's VFformula VFas VFfollow VFs VF= VFhalf VFof VFthe VFtriangle's VFperimeter area VF= VFthe VFsquare VFroot VFof VFs(s-a)(s-b)(s-c), VFwhere VFa, VFb, VFand VFc VFare VFeach VFsides VFof VFthe VFtriangle.: 6.22.6 VFOrdering VFPizza A VFlocal VFpizza VFshop VFis VFselling VFa VFlarge VFpizza VFfor VF$9.99. VFGiven VFthe VFnu VFto VForder VFas VFinput, VFoutput VFthe VFsubtotal VFfor VFthe VFpizzas, VFand VFthen VFou VFafter VFapplying VFa VFsales VFtax VFof VF6%: 7.22.7 VFLAB: VFSquare VFroot

2 f VFthe VFgiven Given VFa VFfloating-point VFnumber VFas VFinput, VFoutput VFthe VFsquare VFroot VFo VFnumber.: 8.22.8 VFLAB: VFVolume VFand VFarea VFof VFcylinder