1. Implement the TriangleArea() function using the Point structure defined in the provided source file. The...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Implement the TriangleArea() function using the Point structure defined in the provided source file. The formula for area of a triangle given three points is: 2 Note: The math library function fabs() returns the absolute value of a double. 2. (40 points) Using the same Point structure defined in Problem 1: a. Implement the SwapPoints() function that will swap two Points. b. Implement the PrintPoints() function that prints an array of Points to the screen with one decimal point and one Point (in parentheses) per line. The number of points to be printed is in the count parameter. This is an example of how it should be formatted: (1.1, 2.2) (3.3, 4.4) (5.5, 6.6) 3. (40 points) Given the Student structure defined in the provided source file, implement the two compare functions as specified below. Each function should return: a value <0 (e.g. -1) if the first parameter is less than the second, O i f they are equal, and a value > 0 (e.g. 1) if the first parameter is greater than the second. For strings, "less" means the string would occur earlier in alphabetical order. You can use the string compare function, strcmp(), from the standard library for strings. Note that it follows the same rules above. a. Implement the CompareName() function to compare two Student records using both the LastName and FirstName members the structures. Last name takes precedence over first name, so for example, "Alice Jones" would be less than "Barbara Jones." b. Implement the Compareld() function to compare two Student structures using the ID member of the structures. 1. Implement the TriangleArea() function using the Point structure defined in the provided source file. The formula for area of a triangle given three points is: 2 Note: The math library function fabs() returns the absolute value of a double. 2. (40 points) Using the same Point structure defined in Problem 1: a. Implement the SwapPoints() function that will swap two Points. b. Implement the PrintPoints() function that prints an array of Points to the screen with one decimal point and one Point (in parentheses) per line. The number of points to be printed is in the count parameter. This is an example of how it should be formatted: (1.1, 2.2) (3.3, 4.4) (5.5, 6.6) 3. (40 points) Given the Student structure defined in the provided source file, implement the two compare functions as specified below. Each function should return: a value <0 (e.g. -1) if the first parameter is less than the second, O i f they are equal, and a value > 0 (e.g. 1) if the first parameter is greater than the second. For strings, "less" means the string would occur earlier in alphabetical order. You can use the string compare function, strcmp(), from the standard library for strings. Note that it follows the same rules above. a. Implement the CompareName() function to compare two Student records using both the LastName and FirstName members the structures. Last name takes precedence over first name, so for example, "Alice Jones" would be less than "Barbara Jones." b. Implement the Compareld() function to compare two Student structures using the ID member of the structures.
Expert Answer:
Answer rating: 100% (QA)
C Program include include include Structure declaration st... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
Evaluate these tax return problems with the support of tax forms, the tax assignment prompt will be shown below: You have been assigned to review the tax return.. Please casually review the return...
-
Write a piece of code that prints an array of integers in reverse order, in the same format as the print method from Section 7.2. Consider putting your code into a method called printBackwards that...
-
You may use all 8 rules of implication, all 10 rules of replacement, conditional proof, and indirect proof to solve the following problems. Remember that any valid argument can be proven using CP or...
-
Start your VM and open a terminal window (note: you may always open more than one terminal window if desired). For this laboratory exam, we will be using the network topology shown in Figure 1....
-
A tax newsletter stated, When a business is sold, part of the sales price may be allocated to tangible assets and part to a covenant not to compete. How this allocation is made can have important tax...
-
Allen, Inc., is expected to pay an equal amount of dividends at the end of the first two years. Thereafter, the dividend will grow at a constant rate of 4 percent indefinitely. The stock is currently...
-
Suppose General Electric (GE) wishes to borrow money from The Canadian Bank. An annual rate of 12 percent is agreed upon. 1. Suppose GE agrees to repay $400 million at the end of five years. How much...
-
You are considering three stocks with the following expected dividend yields and capital gains: a) What is the expected return on each stock? b) How may transactions costs and capital gains taxes...
-
1 4 2 5 6 7 y 10 7 9 5 3 3 Make a scatter plot for the given data. Use the scatter plot to describe whether or not the variables appear to be related. X Graph the point (1,10) Graph the point (4,7)...
-
Financial information for Buckle is presented in Appendix B at the end of the book. Required: 1. Determine the amounts Buckle reports for total assets, total liabilities, and total stockholders...
-
Cambridge Lock Company's normal price for their padlocks is $9.50 per lock. They received a special request from BigBox Hardware requesting 2,500 locks at a price of $7.00 each. Cambridge's factory...
-
Explain The neoclassical (Solow) growth model, Critically assess the extent to facilitate our understanding of the process of technological change and its contribution to economic growth and...
-
Interest rate for an annuity Personal Finance Problem Anna Waldheim was seriously injured in an industrial accident. She sued the responsible parties and was awarded a judgment of $4,000,000. Today,...
-
a) Canada announces that it will be eliminating tariffs on foreign goods one year from now, what will happen to the value of the Canadian dollar? Explain. b) Suppose the governor of the Bank of...
-
In Fiona's product workshop, a particular job, known as VT17, consumed 6,900 of materials, and incurred 60 hours of direct labour during March 20X2. The relevant total production data during March...
-
10 Q.4 Q.3 The cruise ship must provide some sort of security for its travelers and employees. Devise a plan as to how you will ensure guest safety and security in the following areas of the cruise...
-
Presidio, Inc., produces one model of mountain bike. Partial information for the company follows: Required: 1. Complete Presidio's cost data table. 2. Calculate Presidio's contribution margin ratio...
-
Suppose that the laptop of Prob. 2.16 is placed in an insulating briefcase with a fully charged battery, but it does not go into sleep mode, and the battery discharges as if the laptop were in use....
-
The table gives estimates of the world population, in millions, from 1750 to 2000. (a) Use the exponential model and the population figures for 1750 and 1800 to predict the world population in 1900...
-
The speedometer reading (v) on a car was observed at 1-minute intervals and recorded in the chart. Use Simpson's Rule to estimate the distance traveled by the car. t (min v(mi/h)(in)(mi/h) 40 42 45...
-
Solve the equation |2x - 1| - |x + 5| = 3.
-
Andreas Delons Compensation. Andreas Delon is a French citizen who has been offered the position of CEO of LakePharma, a large French pharmaceuticals firm. LakePharma produces high-quality chemicals...
-
EuroVirtuals EPS Sensitivity to Exchange Rates (A). On January 15, 2015 the Swiss National Bank (SNB) decided to unpeg the franc, which was fixed at CHF1.20/ since 2011. Suppose the SNB was to...
-
EuroVirtuals Consolidated Earnings. EuroVirtual pays different tax rates for each of its country operations. a. What are its earnings per share in EUR after deducting taxes? b. What is the proportion...
Study smarter with the SolutionInn App