Homework #6 No Pseudocode – since studying for exam! The Program – Python Complete programming exercise 06-07 on pages 329 (5th edition) of the text book. Other Requirements · Round the average to one...

1 answer below »
The 4 assignments are in the 4 files.


Homework #6 No Pseudocode – since studying for exam! The Program – Python Complete programming exercise 06-07 on pages 329 (5th edition) of the text book. Other Requirements · Round the average to one digit to the right of the decimal point. This should be done in the main() procedure. Screenshot Here's an example of what you program should look like: What To Turn In For this assignment you need to turn in: · Your working Python program file named Homework_06.py. · Run your program and either a screen shot of results or save the shell as Homework_06_Shell_Results.py or .jpg Notes and Comments: See notes in PPT homework page as well as below: · The function determine_grade(): · Should only take one argument, and thus only one parameter. That argument should be a single numeric test score. · Should return the single letter grade that corresponds to the numeric test score that was passed in as an argument. · The function calc_average(): · Should take five arguments, and thus five parameters. There should be one argument for each of the five test scores. · Should return the average all five test scores. · Do not put your print statements inside of your functions. Instead your functions should return the calculated value to the calling procedure (probably main()), and the calling procedure will print the results. This is the opposite of what we did in chapter 3. · All of your assignments must follow the coding standards we discussed in class. · I suggest your check your program against the check list before you turn it in. · Be sure to turn in your assignment via the Blackboard site before then end of class tonight for full credit. Homework #7 The Pseudocode – Input Validation There is no pseudocode assignment for this week due to final exam next week. Please be mindful of pseudocode from this chapter for input validation. Pseudocode will return with chapter 8. The Program – Fat Gram Calculator A variation of Programming Exercise # 3 page 349. Please be sure to read these instructions. Write a program to calculate the percentage of fat calories in a food item. Your program should allow the total number of calories in the food item and the number of grams of fat. Validate the input as follows: · Make sure the number of calories and the number of fat grams are not less than 0. · There are 9 calories in every gram of fat. The calories from fat must not exceed the total calories in the food item. Make sure that the number of calories entered is not greater than fat grams times 9. Tell the user if the item is a low fat food item. A low fat food gets 30% or less of its calories from fat. Screenshot Here's an example of what you program should look like: Suggestions In this assignment you will be checking for reasonableness. You will not be checking for data type mismatch. This is similar in nature to what we did in Program_07_02.py . You do not need a boolean variable in this assignment, like the one we used in Program_07_02b.py. There are several ways to write your loop for defensive programming. I suggest you stick to the author's method used in Program_07_02.py . That was a priming read followed by a while loop. I won't take off points if you do it another way, but this ways is just as easy as the others. Formatting Please note: I’ve been taking off up to 6 points for indentation and spacing mistakes. This is a full letter grade(s) for the assignment. I will take off one point each indentation mistake, up to a maximum of three points. Same for comments, one point for each line error, up to a maximum of three points. Reminder one blank line prior to any comment and two blank lines before a module / procedure / function. Please don’t let these easy fixes happen to you. What To Turn In For this assignment you need to turn in: · Your working Python program file named Homework_07.py. Homework #3a Part 1 – Chapter 3a work The Pseudocode: Sales Tax Program Refactoring Complete pseudocode programming exercise 03-02 page 154 in the text book. See the book for instructions. You do not need to do a flowchart for this exercise. Just the pseudocode. Part 2 below is the python assignment for the same project. See part 2 for samples of output. Write modules for the Program02_06 page 99 continued into Program_03_02 page 154. Part 1 in Homework 2. Take pseudocode you did in Chapter 2 Homework_02.docx and now turn it into Modules in Pseudocode. Write Pseudocode using Chapter 3a methods only. What To Turn In For this assignment you need to turn in: · Your working pseudocode program file named Homework_03a.docx. Notes and Comments · All of your assignments must follow the coding standards we discussed in class. Psuedocode from chapters 1-2, 4 must be used. · I suggest your check your program against the check list before you turn it in. · Be sure to turn in your assignment via the Blackboard site before then end of class tonight for full credit. Grading Details · The maximum points possible for this homework is 15. · This assignment is due on February 28th, 11:59 pm · Late assignments will be accepted until March 8, 11:59 pm · The late penalty is 50% of the points earned. Part 2 – Chapter 3a work The Program: Sales Tax Program Refactoring Write modules for Program02_06 page 99 continued into Program_03_02 page 154. Take pseudocode you did in Chapter 2 Homework_02.docx and now turn it into Python code, but do it using Modules. Write Python code using Chapter 3a methods. Screenshot Here's an example of what you program should look like. What To Turn In For this assignment you need to turn in: · Your working Python program file named Homework_03a.py. · Run your program and either a screen shot of results or save the shell as Homework_03a_Shell_Results.py or .jpg Notes and Comments · All of your assignments must follow the coding standards we discussed in class. · I suggest your check your program against the check list before you turn it in. · Be sure to turn in your assignment via the Blackboard site before then end of class tonight for full credit. _____________________________________________________________________ Homework #3b Part 3 – Chapter 3b work The Program – MPG Costs Write a program that calculates the user's gasoline cost for the month. In the main() procedure your program should prompt the user for the following: · Miles driven per month · Miles per gallon for their car · Price per gallon of gas You should pass these three values to a procedure that will calculate and display the total gasoline cost for the month. You must use a procedure to calculate and display the total cost. Use the appropriate data types. Screenshot Here's an example of what you program should look like. Coding Standards As with all of assignments you must follow all of the coding standards. We will discuss these in class. Notes & Hints · Make sure you follow the directions in this lab. You must use procedures, which we learned in chapter 3. You can make this program work with the material from chapter 2, but you will receive a zero for your assignment. · Do not use the same variables or parameter names in both the main() and your own procedure (we discussed this in class). · The calculation and print statements both belong in your own procedure, not main(). · All of your assignments must follow the coding standards we discussed in class. · I suggest your check your program against the check list before you turn it in. · Be sure to turn in your assignment via the Blackboard site before then end of class tonight for full credit. What To Turn In For this assignment you need to turn in: · Your working Python program file named Homework_03b.py. · Run your program and either a screen shot of results or save the shell as Homework_03b_Shell_Results.py or .jpg Homework #5a (broken into Three Parts 5a 2 and 5b 1 Total 45 points) Please note this combination of assignments will reduce the total course points less 15 points as I removed a second pseudocode from 5b lecture as homework. Part 1 – The Pseudocode: The Program: Tuition Increase Design pseudocode for Exercise Program 05_05. See the book for instructions. You do not need to do a flowchart for this exercise. Just the pseudocode. Notes: · 5-5 - tuition rises 2% for year – Semester same as year so compounded interest · Year 0 semester tuition = $6000 · Year 1 semester tuition = $6000 + .02 * 6000 = $6120 · Year 2 semester tuition = $6120 +. 02 * 6120 = $6242.40 · Note: extra $2.40 in year 2 is interest on the interest from year one or · $120.00 *.02 = $2.40 What To Turn In For this assignment you need to turn in: · Your working pseudocode program file named Homework_05a_05.docx. Notes and Comments · All of your assignments must follow the coding standards we discussed in class. Psuedocode from chapters 1-3a, 4 -5a must be used. · I suggest your check your program against the check list before you turn it in. · Be sure to turn in your assignment via the Blackboard site before then end of class tonight for full credit. _____________________________________________________________________ Homework #5a Part 2 - The Program Write a program that creates a temperature conversion chart for Celsius to Fahrenheit. The program should show values from -15 to 40 degrees Celsius in 2.5 degree increments. Fahrenheit can be converted to Celsius using the following formula: Fahrenheit = 1.8 * Celsius + 32 or Fahrenheit = (9/5) * Celsius + 32 You must use a while loop for this assignment. Do not use a for loop. Use only one loop in your program. Screenshot Here's an example of what you program should look like: What To Turn In For this assignment you need to turn in: · Your working Python program file named Homework_05a.py · Run your program and either a screen shot of results or save the shell as Homework_05a_Shell_Results.py or .jpg Floating Point Math Remember that mixing floating points (a.k.a. double) and integers in Python can be dangerous. Use floating point literals in your calculations, not integers, even if you have to add a .0 to your numbers (e.g. use 2.0 instead of just 2). Notes and Comments · All of your assignments must follow the coding standards we discussed in class. · I suggest your check your program against the check list before you turn it in. · Be sure to turn in your assignment via the Blackboard site before then end of class tonight for full credit. Homework #5b Part 3 – Chapter 5b work in Python Python the Program Variation of `Book Program Exercise 05_12 page 280 Calculating the Factorial of a Number n! In mathematics,
Answered Same DayMar 14, 2021

Answer To: Homework #6 No Pseudocode – since studying for exam! The Program – Python Complete programming...

Ximi answered on Mar 15 2021
135 Votes
3b.py
def calculate_cost(miles, mileage, pay):
    return miles/mileage*pay
def main():
    miles = fl
oat(raw_input("How many miles do you drive per month? "))
    mileage = float(raw_input("How many miles do you get per gallon (MPG)? "))
    pay = float(raw_input("How much do you pay for a gallon of gas?"))
    print ("Your total gas cost is $%f"%calculate_cost(miles, mileage, pay))
if __name__ == '__main__':
    main()
__MACOSX/._3b.py
5b.py
number = int(raw_input("Enter a number: "))
print ("{}! = ".format(number)+\
    " x ".join(map(str, range(1,number+1)))+\
    " = {}".\
    format(reduce(lambda x,y: x*y, range(1, number+1))))
__MACOSX/._5b.py
6.py
def determineGrade(score):
    if score >= 90:
        return 'A'
    elif score...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here