Starting from:

$10

 Assignment #1

Program A: Hello World Edit (helloedit.c):
All experienced programmers know that "Hello World" is supposed to be your first program you ever write. But you've done that, so let's change things up a bit. Edit your Hello World (or rewrite it) to output a custom message of your choosing. Please keep it appropriate, but don't be afraid to be humorous!

Program B: Gas Budget (gas.c):

John's schedule varies each week, depending on both teaching and programming team work.
Some days, he has to drive to (and from) campus for these obligations, other days he can get his work done at home. John is lazy, and doesn't want to have to figure out how much money he has to spend on gas in a given week. As such, he is tricking you into doing his work for him asking you to write a program that will compute the amount of money he will spend on gas in a given week.
Your program should use the following constants in its calculations:
#define MILES_PER_GALLON 23
#define MILES_TO_SCHOOL 25
Your program should prompt the user for the price of gas that week (for simplicity we will assume this is constant for the whole week) and the number of times John has to drive to (and from) campus that week. Your program should then output how much money John has to spend on gas that week. Don't worry about how many digits print after the decimal. Any answer within a penny of the correct answer will be counted as correct.
Sample Program Run (user input in bold and italics):
How much does gas cost this week?
2.40
How many times does John have to drive to campus this week?
3
John must spend $15.65 on gas this week.
Deliverables:
Please submit two separate .c files to the associated assignment on WebCourses by the assigned due date. Make sure both files included a header with comments including: name, date, section, and assignment.
Program A: helloedit.c
Program B: gas.c
Hints:
● Make sure you are declaring, reading, and writing the appropriate data types for each variable.
● Make sure your math is in the correct data type (remember, int / int = int), using type casts to fix this if necessary.
● Make sure your order of operations is correct (otherwise, you will get incorrect
answers).
● You may want to create extra intermediate variables to hold values you compute, rather than try to combine all the math into one line. Don't forget to also name these variables to properly describe what value they contain.
● Give your variables descriptive but short names.
● Test your program with other possible inputs (just because it works with the given one, doesn't necessarily mean it works with all input).
● Don't forget to count both directions of driving.
● Don't forget line breaks (\n).

More products