CPSC 230 In Class Programming Assignment 1: Python Basics solution

$30.00

Category:

Description

5/5 - (8 votes)

Let’s get you writing more code to drive home the basics of the language before we start to get “creative” with our development goals. Make sure to adhere to style and include meaningful comments. Your assignment is to implement the following programs:

 

  1. The first program should be in a module, TotalPrice.py. The program should find the total price of an item given the price and sales tax. The program should prompt the user for the purchase price of an item and the sales tax rate, it should display the total price of the item. The user should be able to enter values such as 10.25 for price and 7.5 for sales tax rate. Think about how you are going to calculate total price, check to make sure it makes sense.

 

  1. The second program should be in a module, Celsius.py.  The program should prompt the user for the temperature in Celsius.  It should then convert this temperature into Fahrenheit and display the temperature in Fahrenheit. The conversion from Celsius to Fahrenheit is as follows:

 

  1. The third program should be in a module, Quadratic.py. The program should prompt the user for the coefficients a, b, c of a quadratic function.  The program should then calculate and display the roots of the function using the quadratic formula.  (Hint: Use the math module to calculate a square root). For now, only use values that will return a positive discriminate, test a = -1, b = 2, c = 3, you should get x = -1 and x = 3 for answers.

 

  1. The fourth program should be in a module, Seconds.py. A day has 86,400 seconds (24*60*60). The program should prompt the user for a number in range 1 to 86,400 and output the current time as hours, minutes, and seconds with a 24-hour clock. For example: 70,000 seconds is 19 hours, 26 minutes, and 40 seconds. (Hint: Think about your quotient integer and quotient remainder operations.)

 

 

Due Date

This assignment is due at 11:59 pm on 2-12-2019. Submit via Blackboard; create a zip file with all your files in it. It should be labeled firstinitiallastname_Assignment1 (i.e. – EStevens_Assignment1). Please make sure to include all the required files (README, source files).

 

Grading

Assignments will be graded on correctness, adherence to style, and the inclusion of meaningful comments.