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....
-
Compare and contrast the real versus the ideal self. List three products for which each type of self is likely to be used as a reference point when a purchase is considered.
-
Chesterfield Company has cash of $60,000, inventory worth $110,000, and a building worth $140,000. Unfortunately, the company also has accounts payable of $190,000, a note payable of $90,000 (secured...
-
Consider a publicly-held company whose products you are familiar with. Some examples might include: Access the companys public website and search for its most recent annual report. (Note: Some...
-
World View is considering production of a lighted world globe that the company would price at a markup of 25 percent above full cost Management estimates that the variable cost of the globe will be...
-
Your company had net income of $115,000 for the year just ended.Dividends of $67,750 were paid on the company's beginning equity of $1,265,000.If the company has 88,000 common shares outstanding with...
-
Jorg is building an office building for Wilmington Company for $20,000,000. The contract has the following characteristics: The office building is built to the customers specifications and the...
-
The Regal Cycle Company manufactures three types of bicycles-a dirt bike, a mountain bike, and a racing bike. Data on sales and expenses for the past quarter follow: B ices Sales Variable...
-
Simplify: a. b. 54 x 53 3 c. (nw)-4 d. (3abc) W 4xy-2 e. f. W 2x-y4
-
When the price goes up, the quantity demanded goes down and the quantity supplied goes up. What happens when companies set the wrong price? Listen to this story about Chuck E Cheese's...
-
Explain THREE ( 3 ) differences between gross method and net method used in recording cash discounts. Explain factoring of receivables with recourse.
-
outline the process (e.g. goal setting, factors to consider, data required, key analysis, stakeholders involved, and judgment logic) that you, as a decision-maker, will use to decide a...
-
Divide 7+6i -1+5i =
-
1. Assume that a 7% coupon bond with a 30 year maturity has a par value of $1,000. Assuming coupon payments are made twice a year; Determine the value of the bond to an investor whose required rate...
-
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.
-
The _________ curve for a product is the horizontal summing of the demand curves of the individuals in the market.
-
A change in _________ leads to a change in quantity demanded, illustrated by a(n) _________ demand curve.
-
An individual _________ curve reveals the different quantities of a particular good a person would be willing and able to buy at various possible prices in a particular time interval, other things...
Study smarter with the SolutionInn App