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 youve done that, so lets 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 dont be afraid to be humorous!
Program B: Gas Budget (gas.c):
Johns 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 doesnt 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 25Your 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. Dont 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.40How many times does John have to drive to campus this week?3John 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.cProgram B: gas.cHints: 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 incorrectanswers). You may want to create extra intermediate variables to hold values you compute, rather than try to combine all the math into one line. Dont 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, doesnt necessarily mean it works with all input). Dont forget to count both directions of driving. Dont forget line breaks (
).
Reviews
There are no reviews yet.