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
-
NVDA\'s latest income statement is below. What was NVDA\'s 2 0 2 3 ROA? All numbers in $ 0 0 0 s 1 / 3 1 / 2 0 2 4 Total Revenue 6 0 , 9 2 2 , 0 0 0 Cost of Revenue 1 6 , 6 2 1 , 0 0 0 Operating...
-
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...
-
Hoc Automotive Ltd. reported a Cash balance of $2 million and a Retained Earnings balance of $12 million. Explain how Hoc Automotive Ltd. can have so much more retained earnings than cash. In your...
-
Using Table 8.5, what is the last price on the June 2008 futures contract? What does the last price mean? TABLE 8.5: COMEX Gold Futures Prices at Market Close on Thursday, August 24, 2007 GOLD (Comex...
-
What are the four stages of the litigation process?
-
1. What is your evaluation of the ethics of domain-name companies earning commissions when people insert ordinary names into their Internet browser? 2. What about the ethics of Google and Yahoo!...
-
ABC Co purchased the following items in year 1: Car Truck Motorcycle Purchase date Dec. 1 01-Aug 30-Sep Purchase Price 75,000 120,000 85,000 Residual Value 5,000 20,000 25,000 7 yrs or 10 yrs or 5...
-
Examine the Apartment worksheet, and apply appropriate names to cells D17:D20. 2. Set up the structure of a one-variable data table on the Analysis worksheet that shows the apartment rental price,...
-
Consider the configuration of current-carrying wires shown below. Two semi-infinite wires carry equal currents I and I2, each with magnitude Io as shown. These wires meet at Point A, where their...
-
Why are the interest rates in the Eurocurrency market important in covered interest arbitrage?
-
Explain how a financial intermediary reduces the cost of contracting and information processing.
-
a. What is the objective of a structured finance operating company? b. What is the most common type of siructured finance operating company?
-
How does covered interest arbitrage relate to interest rate parity?
-
"All financial intermediaries provide the same economic functions. Therefore, the same investment strategy should be used in the management of all financial intermediaries." Indicate whether or not...
-
all of the following are parties to a check except the US Weygandt, Accounting Principles, 13e Help System Announcements Multiple Choice Question 99 All of the following are parties to a check except...
-
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...
-
Consider water flow around a circular cylinder, of diameter \(D\) and length \(l\). In addition to geometry, the drag force is known to depend on liquid speed, \(V\), density, \(ho\), and viscosity,...
-
A 1:10 scale model of a tractor-trailer rig is tested in a wind tunnel. The model frontal area is \(A_{m}=0.1 \mathrm{~m}^{2}\). When tested at \(V_{m}=75 \mathrm{~m} / \mathrm{s}\) in standard air,...
-
The power, \(\mathscr{P}\), required to drive a fan is assumed to depend on fluid density \(ho\), volume flow rate \(Q\), impeller diameter \(D\), and angular speed \(\omega\). If a fan with...
Study smarter with the SolutionInn App