COP 3223H – Week 1 Assignment

$30.00

Category: Tags: , , , , , You will Instantly receive a download link for .zip solution file upon Payment || To Order Original Work Click Custom Order?

Description

5/5 - (4 votes)

Part A: Hello World

Write a program that prints out any greeting (that you wouldn’t mind having your mother read) to
the screen in both C and Python. Make sure your program includes a header comment with your
name, date and program description.

Part B: Road Trip

Write a program (one in C and one in Python) that asks the user for the price of gasoline per
gallon, the number of gallons of gas currently in their car, the miles per gallon their car gets, and
the length of their road trip in miles and calculates and prints out the amount the user will have to
spend on extra gas to complete the road trip.

You may assume that the user will have to buy some
gas to complete the trip. (As usual, make sure you have a header comment with your name, date
and program description, as well as a couple internal comments.)

Sample Program Run (User input is bold and italicized to differentiate it from output.)
What is the price of gasoline in dollars?
2.79
How many gallons of gas are in the car?
3.8
How many miles per gallon does your car get?
25.2
How long is your road trip in miles?
150.5

You need to spend $6.06 on extra gas to complete the trip.

Note: For your python program don’t worry about printing the output to 2 decimal places.

Deliverables

Please turn in the following four source files:
1. hello.c (Part A in C)
2. hello.py (Part A in Python)
3. roadtrip.c (Part B in C)
4. roadtrip.py (Part B in Python)
You will only be allowed to turn in files that end in .c or .py.