Write an accessor function to get the angle

Assignment Help C/C++ Programming
Reference no: EM13316775

Re-combine the three files from the last assignment into one file (so it will be easier to submit and to grade). Add a child class called Parallelogram which has two more private member-variables, one for the acute angle in degrees, and the other for area. Write two constructors, one a default constructor that initializes the acute angle in the parallelogram to be 60 degrees; and the other to pass in an argument for the acute angle in the parallelogram. Write an accessor function to get the angle. Write a member-function that calculates the parallelogram's area.

Write a friend function to compare the area of a rectangle with sides 12 and 8 to the area of a parallelogram with sides 14 and 18 and an acute angle of 40 degrees. Test it in main, and check the answer by hand.

Write a main program to test these functions.

HII\ TS: Set the side lengths and the angle in constructors. Depending on whether you use the inherited constructor, you may have to refer to the handout that had the 4-combinations-of¬constructors. When you want to compare areas, use a friend function to get at that data, and you will probably have to list the friend function in BOTH classes, since you want the Quadrilateral's private data and also the Parallelogram's private data. Then that means you will need to put a "forward reference" at the beginning of your program. Here's how to put in a forward reference: on the next line after using namespace std; you just type class Parallelogram; and that's just before you start the definition of class Quadrilateral. Then later on you have your usual definition of the class Parallelogram with all the listing of its member-functions and member-variables.

(The reason for the forward reference is so you can say, in the friend function's arguments, that you have a variable of type Parallelogram and your program will recognize it is a variable type to-be-defined soon.)

 

Reference no: EM13316775

Questions Cloud

Calculate the production energy required for a 4 kwp system : The story: The Civil Engineering Department would like to have solar panels installed on the roof of Ghausi Hall to supply some of its electricity use - after all there is plenty of space on the roof and plenty of sun in Davis.
Define different career tracks within information technology : The range of information technology (IT) jobs is extensive, but all IT professionals focus on improving usability and the efficiency of technological systems and processes.
Would these motels be better off renting rooms : But in the off-season, when the kids are back at school, one can find rooms for as little as $60 a night. Assume the average fixed cost of a room per night, including local government rates, insurance, taxes and depreciation, is $75.
What power is supplied to the motor : An automobile starter motor has an equivalent resistance of 0.0480 and is supplied by a 12.0 V battery with a 0.0080 internal resistance. What power is supplied to the motor
Write an accessor function to get the angle : Write a friend function to compare the area of a rectangle with sides 12 and 8 to the area of a parallelogram with sides 14 and 18 and an acute angle of 40 degrees. Test it in main, and check the answer by hand.
Determine if intersection provides appropriate changes : Your job as a Highway Patrol Officer is to place a sign to ‘Slow Down' on the freeway prior to a major construction site. The posted freeway speed is 65 mph and a speed of 35 mph is required through the construction site.
What is the final rotational speed of the ball : A ball rolls down a hill 100 m. The hill is inclined 60 degrees. what is the final rotational speed of the ball
What is the rms voltage on the primary side of transformer : AC power is carried to a home via a transmission line, where each wire has a resistance of 0.36 OHMS. What is the rms voltage on the primary side of transformer T2
How long will take until the height is 1 m above the orifice : A tank with a 3m diameter has an 8 cm orifice at the bottom. The tank is currently filled with water to a height of 2.5m above the orifice. If the orifice is opened, how long will it take until the height is 1 m.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Write a linked-list-based push-down stack implementation

Write a linked-list-based push-down stack implementation that keeps items on the list in order from least recently inserted to most recently inserted. You will need to use a doubly linked list.

  Implement recursive algorithms using a stack

Show the difficulties of the added complexity and which of the two sorts is easier to implement nonrecursively? Why?

  You will create a linked list module

You will create a linked list module that exactly meets the specifications given in the supplied header (.h) file. The playlist program must accept a filename on the command line (argv).

  Describe an example of a base

Describe an example of a base and a derived class that shows base-class functions that are overridden in the derived class. Provide the syntax, showing the class definitions of both classes.

  Write c program to find smallest-largest values

Write a program c that will find the smallest, largest and average values in a collection of N numbers.Get the value of N before scanning each value in the collection of N numbers.

  You should use pure recursive calls

You should use pure recursive calls completely and count the number of calls the program makes. You should count how many times recursive calls were made.

  Write a function that accepts an int array

The task calls for: Write a function that accepts an int array and the array's size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should return a pointer t..

  Optimization is to add a sorting algorithm

The second optimization is to add a sorting algorithm. Each time you add an item to the array (from disk or from keyboard), you call a function called SortMyArray(), which use the bubble sorting algorithm to sort the array in the ascending order, ..

  Temperature conversions

Temperature Conversions. The following problems generate temperature- conversion tables. Use following equations that give relationships between temperatures in degrees Fahrenheit(Tf), degree Celsius(Tc), degrees Kelvin(Tk), and degrees Rankin(Tr);

  Prompts the user to enter an integer

Write the code that prompts the user to enter an integer between 1 and 20 (including 1 and 20), reads the value using cin, and then prints the value that they entered in a statement that begins with "You entered a ". Save this version in a separate l..

  Develop a program that when you pipe in a file

develop a program that when you pipe in a file it will demonstrate on the left had side the line number  work by having a program piped in and when a \n occurs a new line and number is indicated.

  Write a program that asks the user to enter the monthly cost

Write a program that asks the user to enter the monthly costs for the following expenses incurred from operating his or her automobile: loan payment, insurance, gas, oil, tires, and maintenance. The program should then display the total monthly cost ..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd