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

  Positive integer value, and computes

Write a function in c++ that reads a positive integer value, and computes

  Describe floyd''s algorithm finds the shortest paths

A shortest path between vertex a and b is a path with the minimum sum of weights of the edges on the path. Floyd's algorithm finds the shortest paths of all vertex pairs of a graph.

  Write a c++ program to calculate the gpa of 5 courses

Write a C++ program to calculate the Gpa of 5 courses. When users enter the grades and credits of the courses from the keyboard

  Struct definition to represent the data of a person''s bank

Define a struct definition to represent the data of a person's bank account. There will be one string for the name, and two doubles for balance and interest rate. Declare two variables of this new type in the main function. Modify the values of each ..

  Write a c++ program to choose two three-digit primes

Write a C++ program to choose two three-digit primes and an encryption exponent (3 or 17 may do nicely).

  Complete the payroll program with following driver object

complete the payroll program with the following driver objects.

  Program that read in from the key board a string

Write a complete C++ program that read in from the key board a string and convert all letters in the string to upper cases. You are not allowed to use toupper function.

  Writing function that computes leap years

Write down function that computes leap years. Function prototype is as follows: Write function body which returns true if year is a leap year and false if year is not a leap year.

  Design a simple game of blackjack

Prepare a simple game of blackjack using object oriented programming.

  Algorithm to determine which items to take to max weight

Write an algorithm to determine which items to take to maximize the weight of his loot bag. He cannot take a fraction of an item and each item must be taken, or left behind. Loot bag size is Z and and the input is an array of item wieghts as integers..

  Write program in c to calculate diameter-compression load

Write a program in C to calculate diameter in centimeters of steel rod, an aluminum rod, and a copper rod, which can withstand a particular compression load.

  Use the lengthof the side as a member variable of the class

write a class including four member functions to compute the areas of an equilateral triangle ,square,hexagon and octagon respectively .Use the lengthof the side as a member variable of the class.

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