How much to do the attached?
CIS122: Lesson 3 Assignment © 2016 Dr. Wayne Machuca CIS122: LESSON 3 ASSIGNMENT ALLOWING USER INPUT BACKGROUND: In this moderately easy assignment, you will be replacing the “hard coded” data values from the “input” portion of the last program, and replacing them with user input instructions. INSTRUCTIONS: INPUT Python allows the instantiation of variables “on the fly”. Therefore, variable name assignments may be optionally created at the top of the program in an area which you will identify as “# Define Variables”. For this exercise, you will define two variables in this area: item_total and order_total. In the Input section of the program, you will display a Welcome Banner, and then prompt the input for three items. You will capture each items name, quantity, and price. You have the option of creating any name for your variables; however, for this exercise, I recommend you follow this pattern: • item1_name • item1_qty • item1_price Do the same for itm2 and itm3. Remember that Python’s input( ) statement captures all data as string. Be sure to place the appropriate wrapper around your input. At run time, choose any data for your input. However, be sure your mathematics is correct before submission. PROCESS/OUTPUT Scripting programming technique will allow for the combining of the process and output activities. You will take advantage of this here by doing your math and output display at the same time. There are multiple possible solutions for this task. Your grade will be based on the efficiency of the coding. AN OPTION Using the item_total variable, determine the line total for the first item. CIS122: Lesson 3 Assignment © 2016 Dr. Wayne Machuca Then, accumulate item_total into the order_total variable. Then, create the print output using { } (“curley braces”) placeholders and the .format( ) to display the item1 values as before. Repeat this technique for all three items. FINAL OUTPUT In the last line of output, display the order total as before. You MUST use the variable values in the print out for credit. Hardcoding the answers into the print statement is forbidden and will result in a zero score. Order for [Your Name] Item Name Price Qty Total 1. apple 0.6 1 0.6 [Note: number of zeros may be longer] 2. banana 1.5 5 7.5 3. cabbage 3 2 6 Order Total: $14.1 SUBMISSION You will create a Word document to submit your solution for both the Calories Counter Program and the Order Program. At the top of the document you MUST identify yourself for credit. [Name] CIS122 – [section] [Date] Lesson 3 Assignment You will then take a screen shot of the programs showing successful results. Copy the screen shot into your document. You will then take a copy of your Python code and paste it into the document below the screen shot. Use the copy/paste technique here. Do NOT do a screen shot of your code. This will result in points off. Save this document for your records, and submit it to the instructor through Blackboard. Remember, your Python code MUST have your name and identification banner as described in the lectures. CIS122: Lesson 3 Assignment © 2016 Dr. Wayne Machuca VALUE This assignment is worth 20 points. Note: This document was checked for ADA Accessibility on December 28, 2017. CIS122: Lesson 3 Assignment © 2016 Dr. Wayne Machuca CIS122: LESSON 3 ASSIGNMENT ALLOWING USER INPUT BACKGROUND: In this moderately easy assignment, you will be replacing the “hard coded” data values from the “input” portion of the last program, and replacing them with user input instructions. INSTRUCTIONS: INPUT Python allows the instantiation of variables “on the fly”. Therefore, variable name assignments may be optionally created at the top of the program in an area which you will identify as “# Define Variables”. For this exercise, you will define two variables in this area: item_total and order_total. In the Input section of the program, you will display a Welcome Banner, and then prompt the input for three items. You will capture each items name, quantity, and price. You have the option of creating any name for your variables; however, for this exercise, I recommend you follow this pattern: • item1_name • item1_qty • item1_price Do the same for itm2 and itm3. Remember that Python’s input( ) statement captures all data as string. Be sure to place the appropriate wrapper around your input. At run time, choose any data for your input. However, be sure your mathematics is correct before submission. PROCESS/OUTPUT Scripting programming technique will allow for the combining of the process and output activities. You will take advantage of this here by doing your math and output display at the same time. There are multiple possible solutions for this task. Your grade will be based on the efficiency of the coding. AN OPTION Using the item_total variable, determine the line total for the first item. CIS122: Lesson 3 Assignment © 2016 Dr. Wayne Machuca Then, accumulate item_total into the order_total variable. Then, create the print output using { } (“curley braces”) placeholders and the .format( ) to display the item1 values as before. Repeat this technique for all three items. FINAL OUTPUT In the last line of output, display the order total as before. You MUST use the variable values in the print out for credit. Hardcoding the answers into the print statement is forbidden and will result in a zero score. Order for [Your Name] Item Name Price Qty Total 1. apple 0.6 1 0.6 [Note: number of zeros may be longer] 2. banana 1.5 5 7.5 3. cabbage 3 2 6 Order Total: $14.1 SUBMISSION You will create a Word document to submit your solution for both the Calories Counter Program and the Order Program. At the top of the document you MUST identify yourself for credit. [Name] CIS122 – [section] [Date] Lesson 3 Assignment You will then take a screen shot of the programs showing successful results. Copy the screen shot into your document. You will then take a copy of your Python code and paste it into the document below the screen shot. Use the copy/paste technique here. Do NOT do a screen shot of your code. This will result in points off. Save this document for your records, and submit it to the instructor through Blackboard. Remember, your Python code MUST have your name and identification banner as described in the lectures. CIS122: Lesson 3 Assignment © 2016 Dr. Wayne Machuca VALUE This assignment is worth 20 points. Note: This document was checked for ADA Accessibility on December 28, 2017. Cameron Swazo CIS122 January 17, 2020 Lesson 2 Assignment # Program: Lesson 2 Calorie Counter # Programmer: Cameron Swazo # Date: January 17, 2020 # Purpose: The purpose of this program is to demonstrate basic input-process-output techniques using Python. In this program, you will build a basic order process. apple_item = str("apple") apple_qty = int(1) apple_price = float(0.60) banana_item = str("banana") banana_qty = int(5) banana_price = float(1.5) cabbage_item = str("cabbage") cabbage_qty = int(3) cabbage_price = float(2) apple_total = apple_qty * apple_price banana_total = banana_qty * banana_price cabbage_total = cabbage_qty * cabbage_price order_total = apple_total + banana_total + cabbage_price print('# Program: Lesson 2 Calorie Counter' + '\n' + '# Programmer: Cameron Swazo' + '\n' + '# Date: January 17, 2020' + '\n' + '# Purpose: The purpose of this program is to demonstrate basic input-process-output techniques using Python. In this program, you will build a basic order process.' + '\n') print('Item Name' + '\t' + 'Price' + '\t' + 'Qty' + '\t' + 'Total') print('1.' + 'apple' + '\t' + '\t' + str(apple_price) + '\t' + str(apple_qty) + '\t' + str(apple_total)) print('2.' + 'banana' + '\t' + str(banana_price) + '\t' + str(banana_qty) + '\t' + str(banana_total)) print('3.' + 'cabbage'+ '\t' + str(cabbage_price) + '\t' + str(cabbage_qty) + '\t' + str(cabbage_total)) print('Otder Total: $ ', order_total)