AP CS Test 6: Inheritance suas ns al 20W (1 1) [18pt] This question involves the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
AP CS Test 6: Inheritance suas ns al 20W (1 1) [18pt] This question involves the using of an interface. A trendy millennial-owned clothing store downtown sells coats, pants, and shirts. The store also allows a customer to buy a "pair," which consists of two of the three items. Each clothing item has a description and a price. The four types of clothing items are represented by the four classes: Coat, Pants, Shirt, and Pair. All four classes extend the following ClothingItem abstract class: public abstract class ClothingItem /** @return the description of the clothing item */ public abstract String getName(); /** @return the price of the clothing item */ public abstract double getPrice (); following The following diagram shows the relationship between the ClothingItem parent class and the Coat, Pants, Shirt, and Pair classes. 71 Jeum casie oda Bru to abbsid. 16 neowded Coat Deat pods suni TOM al eniwollat eri to ClothingItem <<abstract >> Pants on even n60 A erle aswil sidshverl of beinsw uoy 11 (A sdw ,22sb Shirt Pair bow Iani) (A The store allows customers to create a Pair of clothing items which include two of the following: Coat, Pants, or Shirt. The items in the Pair may be different or they might be the same, for example a Pair could be two Coats, or Pants and a Shirt. The Pair's description consists of the first item's name and the second item's name, separated by the word "and" and followed by the word "combo", inserting spaces when appropriate. The price of the Pair is calculated by adding the two items together, and if their value is greater than or equal to $50, the price is reduced by 20%. [That means an order of $49.99 is basically a waste of money, because 1 more cent would have triggered the discount, bringing the price to $40. Rofl Capitalism.] For example, a Pair consisting of a Coat "Blazer" ($60) and a Shirt "Flaming Skull T-Shirt" ($20) would have the description "Blazer and Flaming Skull T-Shirt combo" and a price of $64 (60 + 20 is 80, which is over 50, so there is a 20% discount). A different Pair consisting of Shirt "Hipster Graphic Tee" ($15) and Pants "Uncomfortably Tight Jeans" ($20) would have the description "Hipster Graphic Tee and Uncomfortably Tight Jeans combo" and a price of $35 (which did not receive the discount). [Hint: Remember how to do discount with percentages...] Write the Pair class that extends the ClothingItem class. Your implementation must include a constructor that takes two parameters, which are of type ClothingItem, and any other required methods and/or instance variables. The constructor will be always passed two existing objects. AP CS Test 6: Inheritance suas ns al 20W (1 1) [18pt] This question involves the using of an interface. A trendy millennial-owned clothing store downtown sells coats, pants, and shirts. The store also allows a customer to buy a "pair," which consists of two of the three items. Each clothing item has a description and a price. The four types of clothing items are represented by the four classes: Coat, Pants, Shirt, and Pair. All four classes extend the following ClothingItem abstract class: public abstract class ClothingItem /** @return the description of the clothing item */ public abstract String getName(); /** @return the price of the clothing item */ public abstract double getPrice (); following The following diagram shows the relationship between the ClothingItem parent class and the Coat, Pants, Shirt, and Pair classes. 71 Jeum casie oda Bru to abbsid. 16 neowded Coat Deat pods suni TOM al eniwollat eri to ClothingItem <<abstract >> Pants on even n60 A erle aswil sidshverl of beinsw uoy 11 (A sdw ,22sb Shirt Pair bow Iani) (A The store allows customers to create a Pair of clothing items which include two of the following: Coat, Pants, or Shirt. The items in the Pair may be different or they might be the same, for example a Pair could be two Coats, or Pants and a Shirt. The Pair's description consists of the first item's name and the second item's name, separated by the word "and" and followed by the word "combo", inserting spaces when appropriate. The price of the Pair is calculated by adding the two items together, and if their value is greater than or equal to $50, the price is reduced by 20%. [That means an order of $49.99 is basically a waste of money, because 1 more cent would have triggered the discount, bringing the price to $40. Rofl Capitalism.] For example, a Pair consisting of a Coat "Blazer" ($60) and a Shirt "Flaming Skull T-Shirt" ($20) would have the description "Blazer and Flaming Skull T-Shirt combo" and a price of $64 (60 + 20 is 80, which is over 50, so there is a 20% discount). A different Pair consisting of Shirt "Hipster Graphic Tee" ($15) and Pants "Uncomfortably Tight Jeans" ($20) would have the description "Hipster Graphic Tee and Uncomfortably Tight Jeans combo" and a price of $35 (which did not receive the discount). [Hint: Remember how to do discount with percentages...] Write the Pair class that extends the ClothingItem class. Your implementation must include a constructor that takes two parameters, which are of type ClothingItem, and any other required methods and/or instance variables. The constructor will be always passed two existing objects.
Expert Answer:
Answer rating: 100% (QA)
the Pair class that extends the ClothingItem classThe class should have a constructor that takes two parameterswhich are of type ClothingItemand any other required methods andor instance variablesThe ... View the full answer
Related Book For
Applied Regression Analysis and Other Multivariable Methods
ISBN: 978-1285051086
5th edition
Authors: David G. Kleinbaum, Lawrence L. Kupper, Azhar Nizam, Eli S. Rosenberg
Posted Date:
Students also viewed these programming questions
-
Define the contextual-equivalence relation ` M =ctx M0 : for pairs of PCF terms M, M0 , PCF types , and PCF type environments . [3 marks] (ii) For PCF terms M and N with respective typings ` M : and...
-
1. How strong are the competitive forces confronting J. Crew in the market for specialty retail? Do a [Michael Porter] five-forces analysis to support your answer. (see chapter 3 in the textfor...
-
1. Calculate the budgeted nights booked: Maximum capacity (30 rooms) * Number of days per year (365) * Expected occupancy rate (80%) = 8760 nights. 2. Calculate the tariff revenues: Budgeted nights...
-
Office World Inc. has "cash and carry" customers and credit customers. Office World estimates that 25% of monthly sales are to cash customers, while the remaining sales are to credit customers. Of...
-
Critique the customer contact model. What are its strengths and weaknesses?
-
An inflow of cash would result from which of the following? (a) The increase in an asset account other than cash. (b) The decrease in an asset account other than cash. (c) The decrease in an equity...
-
The Bradley Corporation produces a product with the following costs as of July 1, 2014: Material .........$4 per unit Labor .......... 4 per unit Overhead ....... 2 per unit Beginning inventory at...
-
Troy Hancey has been making payments on his 9.5% boat loan for what seems like forever! Troy made a payment on May 1. His balance after that payment was $3,129.84. He just sold some stock and decides...
-
In attempting to maximize profits, executives and employees of Capital Solutions, Inc., and other corporations have to distinguish between short- run and long-run profit maximization. Business ethics...
-
2. Homer Pty Ltd borrowed $500,000 from the Springfield Bank and granted it a security interest in some of its plant and equipment. Homer Pty Ltd failed to pay the last two interest instalments. The...
-
a drug is bound to serum albumin to the extent of 95% bound. what is the percentage effect on the free levels of the drug of a reduction in binding to 92%
-
Broke Pty Ltd borrowed $500,000 from Bad Bank Ltd. Bad Bank Ltd was granted a security interest in some of Broke Pty Ltd's equipment. Broke Pty Ltd has defaulted on the loan and appointed a voluntary...
-
Difference in standard deviation and beta as measures of risk Security Expected Return Standard Deviation G 14.0% 20% H 12.0% 28% Which security has the least total risk? Which has the least...
-
A cupcake shop average sales price per cupcake is $3.00. Variable cost per cupcake is $1.20. Using the above information, if the cupcake shop wants to earn operating profit of $9,000 per month, how...
-
Refer to the operational plan you developed for Bounce Fitness and develop strategies to recruit new staff and train existing staff to ensure you can meet the operational goals of the business. On...
-
Would you use the adjacency matrix structure or the adjacency list structure in each of the following cases? Justify your choice. a. The graph has 10,000 vertices and 20,000 edges, and it is...
-
The data for this question consist of a sample of 50 persons from the 1967-1980 Evans County Study (Schoenbach et al. 1986). Two basic independent variables are of interest: AGE and chronic disease...
-
A random sample of data was collected on residential sales in a large city. The accompanying table shows the selling price (Y, in $ 1,000s), area (X1, in hundreds of square feet), number of bedrooms...
-
In Problem 19 in Chapter 5 and Problem 14 in Chapter 8, data from the 1990 Census for 26 randomly selected Metropolitan Statistical Areas (MSAs) were discussed. Of interest were factors potentially...
-
Consider a Lorentz covariant expression that is not a Lorentz scalar, \(C^{\lambda}=\) \(K^{\lambda} h\left(A^{\mu} \eta_{\mu u} B^{u}ight)\), where \(h\) is any function of the quantity in...
-
A \(\pi^{-}\)meson with mass \(m_{\pi}=140.0 \mathrm{MeV} / c^{2}\) is produced in a \((p, p)\) collision in an accelerator. The pion subsequently decays into a muon and a muon-type antineutrino, in...
-
The Higgs particle has a mass-energy of \(125 \mathrm{GeV} / c^{2}\). Once created it decays very quickly into various sets of particles: for example, about \(60 \%\) of the time it decays into a...
Study smarter with the SolutionInn App