Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
11 views3 pages

In Lab 03

This document outlines the objectives and requirements for Lab 03 of the CNIT15501 course, focusing on creating a Python program to calculate the volume and surface area of a truncated cone. It includes instructions for writing code, adding comments, and testing the program against desired outputs. Students must submit their .py file on Brightspace and ensure their program runs correctly before submission.

Uploaded by

jeffnumba0
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)
11 views3 pages

In Lab 03

This document outlines the objectives and requirements for Lab 03 of the CNIT15501 course, focusing on creating a Python program to calculate the volume and surface area of a truncated cone. It includes instructions for writing code, adding comments, and testing the program against desired outputs. Students must submit their .py file on Brightspace and ensure their program runs correctly before submission.

Uploaded by

jeffnumba0
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/ 3

CNIT15501 - Introduction To Software Development Concepts 1

InLab03
Objectives 20 Points
• Learn how to work with math and math Library operation
• Learn how to translate formulas
Instructions & Requirements
1) This Python program take the user’s input and calculate the volume and the total
surface area of a truncated cone. Create a new .py file and start writing code.
2) Introductory Comments: Include “Introductory Comments” as below at the
beginning of the program. All your submissions should include a segment of
introductory comments.
#===============================================================
# Your Name & Lab Section: (ex: Purdue Pete, Friday 1:30pm)
# Your Purdue Email:
# Program Description: In your own words, provide a brief,
meaningful description of the program in 1-2 sentences (just
“InLab03” is not meaningful).
# Academic Honesty:
# I attest that this is my original work.
# I have not used unauthorized source code, either modified
or unmodified.
# I have not given other fellow student(s) access to my program.
#=================================================================
3) InLine Comments: Add at least 4 InLine comments to provide explanatory
information about your code.
EX. #Calculate the area of the rectangle #Print
a message to get input from the user

4) See Figure 1 and formulas below. Using these 3 formulas, write code to find a)
volume, b) lateral area, and c) total surface area of a truncated cone.

Figure 1
CNIT15501 - Introduction To Software Development Concepts 2

5) Import math library


6) Define the main() function and write code as follows inside the main():
7) ** Declare necessary variables (at least 7 variables). All the user’s inputs should be
assigned to variables with meaningful names and proper data types (choosing wrong
data types can produce results that are different from the desired outputs).
8) Prompt the user to enter the radius 1 (r1) of a cone.
9) Prompt the user to enter the height (h) of a cone.
10) Prompt the user to enter the slant height (s) of a cone.
11) Prompt the user to enter the radius 2 (r2) of a cone.
12) Using the three formulas above, compute the volume, lateral area, and total
surface area of a cone. You are to use math.pi for the π constant and power function to
calculate squares.
13) Print all the results (volume, lateral area, and total surface area of a cone) with two
decimal places. Check if your results are the same as Desired Outputs below.
14) Call main()

Submission
• Submit the .py file on Brightspace.
• BEFORE submission, test your program by comparing the outputs with Desired
Outputs below.
• AFTER submission, download your submission and test whether your program runs
without any issue (For Windows users, don’t double-click the source code. Run it
using an IDE).
• NO late submission will be accepted.
• There will be penalties for wrong file submission and any errors in the program.
• Only the last submission will be graded, although you can turn in as many as you
want.

Desired Outputs
• BEFORE submission, test your program by comparing the outputs in the example
figures below. Your program MUST produce the same outputs as below when given
the same inputs.

(See page 3!)


CNIT15501 - Introduction To Software Development Concepts 3
Test case 1:

Test case 2:

You might also like