Find Jobs
Hire Freelancers

C program

$20-25 USD

Завершено
Опублікований about 20 years ago

$20-25 USD

Оплачується при отриманні
**The Objective** The objective of this assignment is to get you started writing programs in C in the UNIX environment. Its main emphasis is design, so we will be designing the project together in class. This project will also give you practice writing functions, loops, switch statements and using separate compilation. **The Background ** A **REGULAR POLYGON**is defined as a **convex polygon with all sides congruent and all angles congruent.** The labeled drawings below show what is meant by the terms: **exterior angle**, **interior** or **vertex angle**, **central angle**, and **diagonal**. Realize that any regular polygon, not just the regular hexagon shown, can be divided into the same number of triangles as it has sides, with the base of each triangle being a side of the polygon and that the "tips" of the triangles join in the center of the polygon. All formulae shown in the drawings and also those for perimeter and area shown later are courtesy of [login to view URL] For all formulae shown: n - number of sides s - length of a side A - area of the polygon P - perimeter of the polygon P = n s A = 1/4 n s2 cot(180° / n) ## Deliverables **The Task** code a project that after printing a greeting to the user which contains information about regular polygons, presents the user with a table that shows : the name, number of sides, exterior angles, sum of interior angles, interior angles, and number of diagonals for all n-gons from 3 to 10, inclusive. All values in the table are to be calculated by modular functions. After presenting the table, direct the user to input the number of sides of a polygon and the length of the sides. Use this information to calculate the perimeter and area of that polygon. Restrict the user to regular polygons with n of 3 - 10, inclusive. The user should be allowed to continue to enter polygons as long as s/he wants and should signal the end by entering the sentinel 0 for n. Since you are distributing this software to others, you must use separate compilation and provide the interface for the user. This is in the form of a well commented header (.h) file. You must have 3 files. The file that contains main() **MUST** be called proj1.c; the file containing the function definitions **MUST** be called polygons.c and the header file **MUST** be called polygons.h You are required to use a **switch** statement to handle the printing of the polygon's names. You must also check user input for validity and reprompt for a new value when the user is in error. You must adhere to the design given in class. **The function prototypes given below must be used and may NOT be altered in anyway**. void PrintGreeting (void); void GenerateTable (int min, int max); void PrintInstructions (void); int GetValidNumSides (int sentinel, int min, int max); double GetPositiveValue (void); void PrintName (int numSides); double FindExteriorAngles (int numSides); int FindAngleSum (int numSides); double FindInteriorAngles (double angleSum, int numSides); int FindNumDiagonals(int numSides); double FindPerimeter (int numSides, double side); double FindArea (int numSides, double side); double ConvertDegreesToRadians (double degrees); The following symbolic constants should be used and they should be placed in your proj1.c file above main(): #define SENTINEL 0 #define MIN 3 #define MAX 10 The following symbolic constants should be used and they should be placed at the top of your polygons.c file. NOTE: These symbolic constants would only be placed in the polygons.h file if they were being used by both the proj1.c and polygons.c files. These are not used in proj1.c. It is okay to use them within modular functions' code since they are contained within the same file AND their values will never change. #define HALF_ROTATION 180 #define FULL_ROTATION 360 #define PI 3.14159 #define TRIANGLE 3 #define SQUARE 4 #define PENTAGON 5 #define HEXAGON 6 #define HEPTAGON 7 #define OCTAGON 8 #define NONAGON 9 #define DECAGON 10 **Details about the math library are in attached file** ## Platform unix More information is attached pls check the sample run and notes
ID проекту: 3108674

Про проект

12 пропозицій(-ї)
Дистанційний проект
Активність 20 yrs ago

Хочете заробити?

Переваги подання заявок на Freelancer

Вкажіть свій бюджет та терміни
Отримайте гроші за свою роботу
Опишіть свою пропозицію
Реєстрація та подання заявок у проекти є безкоштовними
Доручений:
Аватарка користувача
See private message.
$11 USD за 2 дні(-в)
5,0 (36 відгуки(-ів))
4,9
4,9
12 фрілансерів(-и) готові виконати цю роботу у середньому за $14 USD
Аватарка користувача
See private message.
$20 USD за 2 дні(-в)
5,0 (159 відгуки(-ів))
6,0
6,0
Аватарка користувача
See private message.
$11,05 USD за 2 дні(-в)
4,9 (195 відгуки(-ів))
5,7
5,7
Аватарка користувача
See private message.
$17 USD за 2 дні(-в)
5,0 (52 відгуки(-ів))
4,9
4,9
Аватарка користувача
See private message.
$21,25 USD за 2 дні(-в)
4,7 (41 відгуки(-ів))
4,7
4,7
Аватарка користувача
See private message.
$12,75 USD за 2 дні(-в)
4,5 (6 відгуки(-ів))
1,7
1,7
Аватарка користувача
See private message.
$6,80 USD за 2 дні(-в)
5,0 (3 відгуки(-ів))
1,3
1,3
Аватарка користувача
See private message.
$21,25 USD за 2 дні(-в)
5,0 (1 відгук)
0,5
0,5
Аватарка користувача
See private message.
$17 USD за 2 дні(-в)
0,0 (0 відгуки(-ів))
0,0
0,0
Аватарка користувача
See private message.
$3,40 USD за 2 дні(-в)
0,0 (0 відгуки(-ів))
0,0
0,0
Аватарка користувача
See private message.
$17 USD за 2 дні(-в)
0,0 (0 відгуки(-ів))
0,0
0,0
Аватарка користувача
See private message.
$8,50 USD за 2 дні(-в)
0,0 (1 відгук)
0,0
0,0

Про клієнта

Прапор UNITED STATES
United States
5,0
18
На сайті з бер. 10, 2003

Верифікація клієнта

Дякуємо! Ми надіслали на вашу електронну пошту посилання для отримання безкоштовного кредиту.
Під час надсилання електронного листа сталася помилка. Будь ласка, спробуйте ще раз.
Зареєстрованих користувачів Загальна кількість опублікованих робіт
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Завантажуємо для перегляду
Дозвіл на визначення геолокації надано.
Ваш сеанс входу закінчився, і сеанс було закрито. Будь ласка, увійдіть знову.