Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Description: Create five (5) c programs that can be executed correctly in the Linux servers. Submit your c programs (.c and .o) in a zipped

Description: Create five (5) c programs that can be executed correctly in the Linux servers. Submit your c programs (.c and .o) in a zipped file (.zip). General evaluation elements: * When provided, file names must follow the names described in each program * Each program must have a comment section at the beginning of the file which must include: - course's name, - semester (Winter 2020), - student's name, - assignment's number, and - program's description. * Indentation will be evaluated * Execution of .o file * Code of .c file */ Program 1 ============ Program: grid.c Executable: grid.o Printing a grid. Write a program that prints the following grid to play tic-tac-toe. +--+--+--+ | | | | +--+--+--+ | | | | +--+--+--+ | | | | +--+--+--+ Of course, you could simply write seven statements of the form printf("+--+--+--+ "); However, you will create two constants that hold the two kinds of patters; print the first pattern 4 times, and the second pattern 3 times. Program 2 ============ Program: ctree.c Executable: ctree.o Write a program that prints a Christmas tree: /\' / \' / \' / \' -------- " " " " " " Program 3 ============ Program: mitime.c Executable: mitime.o Write a program that reads two times in military format (e.g. 0900, 1730), and prints the number of hours and minutes between the two times. Assume that the hours and minutes of the second time are greater than the first time. See an example below. User input is underlined (your program does not have to underline the user input). Please enter the first time: 0900 ---- Please enter the second time: 1730 ---- 8 hours 30 minutes Program 4 ============ Program: bookstore.c Executable: bookstore.o The following pseudocode describes how a bookstore computes the price of an order from the total price and the number of the books that were ordered. Read the total book price and the number of books. Compute the tax (7.5 percent of the total book price). Compute the shipping charge ($2 per book). The price of the order is the sum of the total book price, the tax, and the shipping charge. Program 5 ============ Program: easter.c Executable: easter.o Easter Sunday is the first Sunday after the first full moon of spring. To compute the date, you can use this algorithm, invented by the mathematician Carl Friedrich Gauss in 1800: 1. Let y be the year (such as 1800 or 2001) 2. Divide y by 19 and call the remainder a. Ignore the quotient. 3. Divide y by 100 to get a quotient b and a remainder c. 4. Divide b by 4 to get a quotient d and a remainder e. 5. Divide 8 * b + 13 by 25 to get a quotient g. Ignore the remainder. 6. Divide 19 * a + b - d - g + 15 by 30 to get a remainder h. Ignore the quotient. 7. Divide c by 4 to get a quotient j and a remainder k. 8. Divide a + 11 * h by 319 to get a quotient m. Ignore the remainder. 9. Divide 2 * e + 2 * j - k - h + m + 32 by 7 to get a remainder r. Ignore the quotient. 10. Divide h - m + r + 90 by 25 to get a quotient n. Ignore the remainder. 11. Divide h - m + r + n + 19 by 32 to get a remainder p. Ignore the quotient. The Easter faqs on day p of month n. For example, if y is 2001: a = 6 b = 20, c = 1 d = 5, e = 0 g = 6 h = 18 j= 0, k = 1 m = 0 r = 6 n = 4 p = 15 Therefore, in 2001, Easter Sunday fell on April 15. Write a program that prompts the user for a year and prints out the month and day of Easter Sunday.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Power Of Numbers In Health Care A Students Journey In Data Analysis

Authors: Kaiden

1st Edition

8119747887, 978-8119747887

More Books

Students also viewed these Databases questions