Description
see what i attached and solve the questions?
Unformatted Attachment Preview
Purchase answer to see full attachment
Explanation & Answer
Hello please check the two assignment Thank you for your time
Solution to COSC 111.003 (Spring 2016)
Assignment 1 (100 Points)
Due date: March 10th, 2017
Question 1 (30 Points)
(a) Develop an algorithm of the above problem in both pseudo code and flowchart based on
determining the inputs and outputs, breaking down the problem into smaller tasks, and describe
each subtask in pseudo code.
Solution
For each car, compute the total cost as follows:
fuel consumed = miles driven / fuel efficiency
fuel cost = price per gallon x fuel consumed
total cost = purchase price + fuel cost
If total cost 1 < total cost 2
Choose car 1
Else
Choose car 2.
Flowchart
(b). Test your algorithm by working a problem with the following sample values:
miles_driven = 12000 * 2
price_per_gallon = 3
def car1_totalcost(miles_driven,price_per_gallon):
car1_cost = int(input('Enter purchase price for car1'))
car1_fuele = int(input('Enter fuel efficiency for car1'))
fuel_consumed = miles_driven / car1_fuele
fuel_cost = price_per_gallon * fuel_consumed
totalcost = car1_cost + fuel_cost
return totalcost
def car2_totalcost(miles_driven,price_per_gallon):
car2_cost = int(input('Enter purchase price for car2'))
car2_fuele = int(input('Enter fuel efficiency for car2'))
fuel_consumed ...