Preface: How to Use the Instructor’s Manual CS225 Fundamentals of Computer Science XXXXXXXXXXCourse Syllabus Fall 2013 Dr. Simon Lin XXXXXXXXXXVersion: 09/02/2013 CS119 Python Programming XXXXXXXXXXPJ...

1 answer below »
attached file


Preface: How to Use the Instructor’s Manual CS225 Fundamentals of Computer Science Course Syllabus Fall 2013 Dr. Simon Lin Version: 09/02/2013 CS119 Python Programming PJ 8 Dr. Lin Version 1/11/21 PJ 8 – Number Game Please write a Python program that will keep accepting 3 integer numbers from the user, and output these 3 numbers in ascending order, the sum, and the average of these 3 numbers. You must stop your program when the first number from the user is -777. Design Specifications and Regulations: (1) You must use your full name on your Welcome and Thank-you messages. (2) You must define all the following 5 functions in your program with no exception: def max (p, q, r) # return the maximum of these 3 integer parameters def min (p ,q , r) # return the minimum of these 3 integer parameters def mid (p, q, r) # return the middle of these 3 integer parameters def sum (p, q, r) # return the sum of these 3 integer parameters def avg (p, q, r) # return the average of these 3 integer parameters, can call sum(p, q, r) here. (3) You must NOT use any existing Python functions in your program. (4) You must NOT sort those 3 numbers in order to print them in order. You must print them in order by printing minimum, middle, and then maximum. (5) You must fully test your program to make sure these 5 functions are working perfectly for any data. (6) How can we show three numbers (p, q, r) in ascending order without sorting them? You show the minimum, the middle, and the maximum number of p, q, and r. (7) What is the algorithm for the function mid (p, q, r)? There are two cases for p to be the middle number. If q <= p=""><= r="" then="" return="" p="" ;="" #="" case="" 1="" for="" p="" is="" the="" middle="" :="" q="" p="" r="" if="" r=""><= p=""><= q then return p ; # case 2 for p is the middle : r p q ===========================================================================. the output of your test case #1 must look exactly as follows including the data. you must also do test case #2 and test case #3 with different sets of data to prove that your program is working perfectly for any data. each test case or test run must begin with a welcome message, and must end with a thank-you message. welcome to this number game of "dr. simon lin"! must use your name! 1-----------------------------------------------------------------------------------. enter first number: 9 enter second number: 7 enter third number: 5 you just entered 3 integers: 9 7 5 these 3 integers in order are 5 7 9 their sum is 21 and their average is 7.0 2------------------------------------------------------------------------------------. enter first number: 6 enter second number: 8 enter third number: 10 you just entered 3 integers: 6 8 10 these 3 integers in order are 6 8 10 their sum is 24 and their average is 8.0 3------------------------------------------------------------------------------------. enter first number: 9 enter second number: 1 enter third number: 8 you just entered 3 integers: 9 1 8 these 3 integers in order are 1 8 9 their sum is 18 and their average is 6.0 4-------------------------------------------------------------------------------------. enter first number: 7 enter second number: 7 enter third number: 7 you just entered 3 integers: 7 7 7 these 3 integers in order are 7 7 7 their sum is 21 and their average is 7.0 5----------------------------------------------------------------------------------. enter first number: 8 enter second number: 2 enter third number: 2 you just entered 3 integers: 8 2 2 these 3 integers in order are 2 2 8 their sum is 12 and their average is 4.0 6----------------------------------------------------------------------------------. enter first number: 8 enter second number: 8 enter third number: 2 you just entered 3 integers: 8 8 2 these 3 integers in order are 2 8 8 their sum is 18 and their average is 6.0 7----------------------------------------------------------------------------------. enter first number: -6 enter second number: -3 enter third number: -9 you just entered 3 integers: -6 -3 -9 these 3 integers in order are -9 -6 -3 their sum is -18 and their average is -6.0 8----------------------------------------------------------------------------------. enter first number: -777 enter second number: 0 enter third number: 0 9----------------------------------------------------------------------------------. thank you for playing this number game of "dr. simon lin"! must use your name! 10---------------------------------------------------------------------------------. =========================================================================. how to submit your project assignment (pj)? (1) each program must be well documented with block comments and proper line comments. the beginning of each program must have a block comment to show its author, date, and purpose. the following is an example of block comments: # author: _______________ must use your full name here! # date: _________ must put today’s date here! # purpose: _______________ must show the purpose of this program here! (2) you must submit to canvas the following two items as attachments: (a) your source program (for example, cs119-pj8.py ), and (b) your word document (for example, cs119-pj8-report .docx ) containing the listing of your python program, and the complete output of your 3 test runs as specified. you must not submit a zip file to canvas. =========================================================================. // please delete everything above this line to make this your word document to be submitted. pj 8 report my name: ______________ a. the following is my python source program: // please copy your source program into here from your visual studio ide. // your code here must be in color. you should not show screen prints here. b. the following is the console output of my 3 test runs: // one way to copy the console output is to press ctrl+alt+prtscn. // another way to copy is to use the snipping tool. to paste the image is to press ctrl+v. // please make sure your console is long enough to show all your output lines to be captured. // please copy your console output and paste into here: test case #1: test case #2: test case #3: page 1 of 1 page 1 of 3 q="" then="" return="" p="" ;="" #="" case="" 2="" for="" p="" is="" the="" middle="" :="" r="" p="" q="==========================================================================." the="" output="" of="" your="" test="" case="" #1="" must="" look="" exactly="" as="" follows="" including="" the="" data.="" you="" must="" also="" do="" test="" case="" #2="" and="" test="" case="" #3="" with="" different="" sets="" of="" data="" to="" prove="" that="" your="" program="" is="" working="" perfectly="" for="" any="" data.="" each="" test="" case="" or="" test="" run="" must="" begin="" with="" a="" welcome="" message,="" and="" must="" end="" with="" a="" thank-you="" message.="" welcome="" to="" this="" number="" game="" of="" "dr.="" simon="" lin"!="" must="" use="" your="" name!="" 1-----------------------------------------------------------------------------------.="" enter="" first="" number:="" 9="" enter="" second="" number:="" 7="" enter="" third="" number:="" 5="" you="" just="" entered="" 3="" integers:="" 9="" 7="" 5="" these="" 3="" integers="" in="" order="" are="" 5="" 7="" 9="" their="" sum="" is="" 21="" and="" their="" average="" is="" 7.0="" 2------------------------------------------------------------------------------------.="" enter="" first="" number:="" 6="" enter="" second="" number:="" 8="" enter="" third="" number:="" 10="" you="" just="" entered="" 3="" integers:="" 6="" 8="" 10="" these="" 3="" integers="" in="" order="" are="" 6="" 8="" 10="" their="" sum="" is="" 24="" and="" their="" average="" is="" 8.0="" 3------------------------------------------------------------------------------------.="" enter="" first="" number:="" 9="" enter="" second="" number:="" 1="" enter="" third="" number:="" 8="" you="" just="" entered="" 3="" integers:="" 9="" 1="" 8="" these="" 3="" integers="" in="" order="" are="" 1="" 8="" 9="" their="" sum="" is="" 18="" and="" their="" average="" is="" 6.0="" 4-------------------------------------------------------------------------------------.="" enter="" first="" number:="" 7="" enter="" second="" number:="" 7="" enter="" third="" number:="" 7="" you="" just="" entered="" 3="" integers:="" 7="" 7="" 7="" these="" 3="" integers="" in="" order="" are="" 7="" 7="" 7="" their="" sum="" is="" 21="" and="" their="" average="" is="" 7.0="" 5----------------------------------------------------------------------------------.="" enter="" first="" number:="" 8="" enter="" second="" number:="" 2="" enter="" third="" number:="" 2="" you="" just="" entered="" 3="" integers:="" 8="" 2="" 2="" these="" 3="" integers="" in="" order="" are="" 2="" 2="" 8="" their="" sum="" is="" 12="" and="" their="" average="" is="" 4.0="" 6----------------------------------------------------------------------------------.="" enter="" first="" number:="" 8="" enter="" second="" number:="" 8="" enter="" third="" number:="" 2="" you="" just="" entered="" 3="" integers:="" 8="" 8="" 2="" these="" 3="" integers="" in="" order="" are="" 2="" 8="" 8="" their="" sum="" is="" 18="" and="" their="" average="" is="" 6.0="" 7----------------------------------------------------------------------------------.="" enter="" first="" number:="" -6="" enter="" second="" number:="" -3="" enter="" third="" number:="" -9="" you="" just="" entered="" 3="" integers:="" -6="" -3="" -9="" these="" 3="" integers="" in="" order="" are="" -9="" -6="" -3="" their="" sum="" is="" -18="" and="" their="" average="" is="" -6.0="" 8----------------------------------------------------------------------------------.="" enter="" first="" number:="" -777="" enter="" second="" number:="" 0="" enter="" third="" number:="" 0="" 9----------------------------------------------------------------------------------.="" thank="" you="" for="" playing="" this="" number="" game="" of="" "dr.="" simon="" lin"!="" must="" use="" your="" name!="" 10---------------------------------------------------------------------------------.="========================================================================." how="" to="" submit="" your="" project="" assignment="" (pj)?="" (1)="" each="" program="" must="" be="" well="" documented="" with="" block="" comments="" and="" proper="" line="" comments.="" the="" beginning="" of="" each="" program="" must="" have="" a="" block="" comment="" to="" show="" its="" author,="" date,="" and="" purpose.="" the="" following="" is="" an="" example="" of="" block="" comments:="" #="" author:="" _______________="" must="" use="" your="" full="" name="" here!="" #="" date:="" _________="" must="" put="" today’s="" date="" here!="" #="" purpose:="" _______________="" must="" show="" the="" purpose="" of="" this="" program="" here!="" (2)="" you="" must="" submit="" to="" canvas="" the="" following="" two="" items="" as="" attachments:="" (a)="" your="" source="" program="" (for="" example,="" cs119-pj8.py="" ),="" and="" (b)="" your="" word="" document="" (for="" example,="" cs119-pj8-report="" .docx="" )="" containing="" the="" listing="" of="" your="" python="" program,="" and="" the="" complete="" output="" of="" your="" 3="" test="" runs="" as="" specified.="" you="" must="" not="" submit="" a="" zip="" file="" to="" canvas.="========================================================================." please="" delete="" everything="" above="" this="" line="" to="" make="" this="" your="" word="" document="" to="" be="" submitted.="" pj="" 8="" report="" my="" name:="" ______________="" a.="" the="" following="" is="" my="" python="" source="" program:="" please="" copy="" your="" source="" program="" into="" here="" from="" your="" visual="" studio="" ide.="" your="" code="" here="" must="" be="" in="" color.="" you="" should="" not="" show="" screen="" prints="" here.="" b.="" the="" following="" is="" the="" console="" output="" of="" my="" 3="" test="" runs:="" one="" way="" to="" copy="" the="" console="" output="" is="" to="" press="" ctrl+alt+prtscn.="" another="" way="" to="" copy="" is="" to="" use="" the="" snipping="" tool.="" to="" paste="" the="" image="" is="" to="" press="" ctrl+v.="" please="" make="" sure="" your="" console="" is="" long="" enough="" to="" show="" all="" your="" output="" lines="" to="" be="" captured.="" please="" copy="" your="" console="" output="" and="" paste="" into="" here:="" test="" case="" #1:="" test="" case="" #2:="" test="" case="" #3:="" page="" 1="" of="" 1="" page="" 1="" of="">
Answered Same DayFeb 06, 2021

Answer To: Preface: How to Use the Instructor’s Manual CS225 Fundamentals of Computer Science XXXXXXXXXXCourse...

Neha answered on Feb 06 2021
151 Votes
75427 - number game/75427 - number game.py
def max(p,q,r):
if p>q and p>r:
return p
elif q>p and q>r:
return q
else:
return r
def min(p,q,r):
if p return p
elif q

return q
else:
return r
def mid(p,q,r):
if q <= p and p<=r:
return p
elif p <= q and q<=r:
return q
else:
return r
def sum(p,q,r):
return p+q+r
def avg(p,q,r):
average = (p+q+r)/2
return average
print("Welcome to this Number Game of Melanie Benitez")
while True:
p = int(input("Enter first number"))
q = int(input("Enter second number"))
r = int(input("Enter third...

SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here