Ask a question to Desklib · AI bot


CSC121 PYTHON Programming Lab

5 Pages1646 Words721 Views

Added on  2019-09-16

BookmarkShareRelated Documents
_______________________________________________________________________CSC121PYTHON PROGRAMMING_______________________________________________________________________LAB 01DESIGNING ALGORITMS FOR COMPUTER PROGRAMSOBJECTIVESIn this lab assignment, students will learn:- How to design algorithms for computer programs- How to design steps for getting user input- How to design steps for processing- How to design steps for displaying output- How to execute steps by hand and keep track of value changes in variablesGOALSIn this lab assignment, students will demonstrate the abilities to:- Design algorithms for computer programs- Design steps for getting user input- Design steps for processing- Design steps for displaying output- Execute steps by hand and keep track of value changes in variablesINSTRUCTIONAND PROBLEMSThere are five problems in this lab. For each problem, please do the following:(a)Design an algorithm for a computer program to solve the problem. All algorithms in this lab should include input steps, processing steps (e.g. steps performing calculations) and output steps. (b)Execute your algorithm by hand and use a table to show value changesof the variables with the test cases provided.The following is an example only. You must use the format of this example in the five programs to receive full credit.Problem to solve: The power of an air conditioner is measured in British Thermal Units (BTU). The higher the BTU, the more heat the air conditioner can bring away. When people buy an air conditioner, they need to know how many
CSC121 PYTHON Programming Lab_1
______________________________________________________________________________________________________________________________________________________________________________________________________________________CSC121Lab 01Page 2______________________________________________________________________________________________________________________________________________________________________________________________________________________BTU they need to keep the room cool. Design a program to estimate howmany BTU we need when we install a window air conditioner in a room. This number is determined by the volume of the room. The rule of thumbis that we need 3.5 BTU per cubic foot. The program should ask the user to enter the length, width and height of the room. It should calculate and display the number of BTU needed for the air conditioner.Execute your algorithm by hand with this test case: room length = 15, room width = 11 and room height =10. Create a table to show how the value of each variable changes during program execution.Algorithm: Step 1: Input the length of the roomStep 2: Input the width of the roomStep 3: Input the height of the roomStep 4: Calculate volume = length * width * heightStep 5: Calculate BTU needed = volume * 3.5Step 6: Display BTU neededVariable Table:StepRoomlengthRoomwidthRoomheightRoomvolumeBTUneededInput room length15Input room width1511Input room height151110Calculate volume = length * width * height1511101650Calculate BTU needed =volume * 3.515111016505775Display BTU needed15111016505775You need to submit an algorithm and a variable tablefor each problem. Please type and save your answers for all five problems in a single MicrosoftWord document. You may copy the table from above and just modify it for your programs. Submit the file to Blackboard for credit. The document should be named Lab01.docxPROBLEM 1Mary is a big fan of tropical fish. She has a few tanks of fish at home. To maintain a healthy environment for the fish, she needs to add conditioner to the water once a week. The amount of conditioner added is determined by
CSC121 PYTHON Programming Lab_2

Found this document preview useful?