b) A graphical user interface is being developed that displays basics shapes on the screen. There...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
b) A graphical user interface is being developed that displays basics shapes on the screen. There are three classes that a programmer has been tasked to design: shape, square, and circle. shape should be an abstract class and square and circle are concrete (i.e. not abstract) subclasses of shape. To hold the size information, each class has a protected field length of type float. The value of this field is only stored in the shape class and its value is initially set by the three constructors. Each class also has a getter and a setter method. All three classes have a function float calculateArea (). In the class shape this is defined as virtual float calculateArea () const = 0; The function returns length*length for square and 3.14*length² for the circle class. i) Write the classes described above in C++. ii) In the calculateArea definition explain the meaning of the following parts: virtual, float, const and =0. [8 marks] [4 marks] b) A graphical user interface is being developed that displays basics shapes on the screen. There are three classes that a programmer has been tasked to design: shape, square, and circle. shape should be an abstract class and square and circle are concrete (i.e. not abstract) subclasses of shape. To hold the size information, each class has a protected field length of type float. The value of this field is only stored in the shape class and its value is initially set by the three constructors. Each class also has a getter and a setter method. All three classes have a function float calculateArea (). In the class shape this is defined as virtual float calculateArea () const = 0; The function returns length*length for square and 3.14*length² for the circle class. i) Write the classes described above in C++. ii) In the calculateArea definition explain the meaning of the following parts: virtual, float, const and =0. [8 marks] [4 marks]
Expert Answer:
Answer rating: 100% (QA)
This prompt appears to be a part of an assignment or an exam relating to objectoriented programming in C Below Ill address the two parts of the questi... View the full answer
Related Book For
Systems analysis and design
ISBN: ?978-1118808177
5th edition
Authors: Alan Dennis, Barbara Haley Wixom, Roberta m. Roth
Posted Date:
Students also viewed these programming questions
-
What am I required to do in this assignment? Shared Power is an information system to help tradesmen share expensive and specialist tools rather than buying them themselves. Registered owners add...
-
Managing Scope Changes Case Study Scope changes on a project can occur regardless of how well the project is planned or executed. Scope changes can be the result of something that was omitted during...
-
1. Was the contract between Joel King and Barber bilateral or unilateral? 2. What was bargained for and given in exchange by each party? Mark P. Painter, Judge This case involves neighbors and the...
-
Weisberg Corporation has 10,000 shares of $100 par value, 6%, preference shares and 50,000 ordinary shares of $10 par value outstanding at December 31, 2019. Instructions Answer the questions in each...
-
Suppose that a firm?s production function is given by ?where ?and? a. As L increases, what happens to the marginal product of labor? b. As? K increases, what happens to the marginal product of labor?...
-
Consider PowerBar, the strategy for which is summarized in the PowerBar case. What implications for the culture, structure, systems, and people would you suggest given the nature of the product and...
-
1. Cost out these packages given the data in Exhibits 1 and the information obtained from various insurance carriers and other information sources (Exhibit 4). Exhibit 1: Current compensation costs...
-
3. The distance between carbon atoms in diamond is 0.154 nm. What is this distance in meters? Have Factor 0.154 nm 1 x 10^9nm Want 1.54 x 10^-10m 4. Calculate the number of grams in 32.0 lbs....
-
Jocame Inc. began business on January 2, 20Y7. Salaries were paid to employees on the last day of each month, and social security tax, Medicare tax, and federal income tax were withheld in the...
-
Calculate the projected values of the following from the table below for 1990 to 1994 Cash Working Capital Net Fixed Assets Other Assets Total Assets Historical and Pro Formas Divisions LPD Sales...
-
What are the rules with respect to fees?
-
Outline how an auditor can assess the adequacy of their clients closing procedures.
-
What are the three components of audit risk?
-
What is quantitative materiality?
-
What can be done to reduce the audit expectation gap?
-
For the systems shown in figure; a) Determine the degree-of-freedom of the system. b) Draw the free-body-diagram and indicate the forces acting on the bodies c) Derive the equation of motion(s) of...
-
Suppose the government bond described in problem 1 above is held for five years and then the savings institution acquiring the bond decides to sell it at a price of $940. Can you figure out the...
-
What circumstances favor using outsourcing to obtain the new system?
-
Discuss the role users play in testing.
-
Explain what is meant by a nonfunctional requirement. What are the primary types of nonfunctional requirements? Give two examples of each. What role do nonfunctional requirements play in the project...
-
Derivatives allow firms to arbitrarily divide up and rename risks and future payments, rendering their actual names irrelevant.
-
Options give the buyer (option holder) a right and the seller (option writer) an obligation to buy or sell an underlying asset at a predetermined price on or before a fixed future date. a. A call...
-
Interest rate swaps are agreements between two parties to exchange a fixed for a variable interest rate payment over a future period. a. The fixed rate payer in a swap typically pays the U.S....
Study smarter with the SolutionInn App