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....
-
Draw a scatter diagram of the price of gasoline and the quantity of gasoline refined. Describe the relationship. The spreadsheet provides data on oil and gasoline: Column A is the year, column B is...
-
Saks Incorporated, a major U.S. retailer, reported the following amounts in the asset section of its balance sheets for the years ended January 29, 2011, and January 30, 2010: In addition, the 2011...
-
Petitioner Christy Brzonkala met respondents Antonio Morrison and James Crawford at a campus party at Virginia Polytechnic Institute (Virginia Tech), where they were all students. At the party, the...
-
1. Would an ERP strategy work well for Personal Trainer? Investigate ERP strategies and products available from Internet vendors and submit a recommendation based on your research. 2. If Susan...
-
6) You must show the working to earn marks The height y (in feet) of a punted football is given by 20 9 y= + -x+1.6 2025 5 where x is the horizontal distance (in feet) from the point at which the...
-
Three different analytical methods are compared for determining Ca in a biological sample. The laboratory is interested in knowing whether the methods differ. The results shown below represent Ca...
-
If the number of employed persons in a country equals 24 million, the number of unemployed persons equals 16 million, and the number of persons over age 16 in the population equals 60 million, the...
-
Once the project management plan is complete and accepted by the stakeholders, the approved plan is ____________________. a. reviewed b. baselined c. followed d. documented
-
How do lessons learned fit into quality planning?
-
Why is it important to go through the process of closing, even for projects that are terminated early?
-
Should activities on the critical path be outsourced? Why or why not?
-
If your sponsor asks for an estimate as to how much more money your team needs to complete all project work as scheduled, which of the following formulas might you use? a. BAC 2 EAC b. EV/PV c. (BAC...
-
You are going to perform a CFD simulation on an intake manifold and you need the velocity inlet boundary conditions. The engine is a four-cylinder, four-stroke, 2.0-liter, SI engine. The volumetric...
-
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.
-
Reconsider the data of Problem 31. Data from Problem 31 The following three investment opportunities are available. The returns for each investment for each year vary, but the first cost of each is...
-
The following three investment opportunities are available. The returns for each investment for each year vary, but the first cost of each is $20,000. Based on a future worth analysis, which...
-
Explain the relationship between the finite sample \(F\)-test and the large sample \(\chi^{2}\)-test, and the assumptions under which each is suitable.
Study smarter with the SolutionInn App