Home / Questions / Write a class named RetailItem that holds data about an item in a retail store...
Part 1: Write a class named RetailItem that holds data about an item in a retail store. The class should have the
following fields:
• description. The description field references a String object that holds a brief description of the item.
• unitsOnHand. The unitsOnHand field is an int variable that holds the numbers of units currently in inventory.
• price. The price filed is a double that holds the item's retail price.
Write a constructor that accepts arguments for each field, appropriate mutator methods that store values in these
fields, and accessor methods that returns the values in these fields.
After this, write a method in the RetailItem class called purchaseItem. This method will be used to simulate an item(s)
purchase. It will accept as a parameter the variable totalItemsToPurchase representing a number of units to buy (e.g.
10). The method should check if its unitsOnHand is enough to satisfy the purchase. If it is not, notify the user. If it is
enough, update unitsOnHand with the new value (unitsOnHand – totalItemsToPurchase) and return to the user the total
cost of the purchase (itemsToPurchase * price).
Attachments:
Apr 02 2020 View more View Less
Find a real number c and a positive number L for which
Jul 27 2021Assume that the British pound is worth 1.6242 U.S. dollars. If a new Jaguar costs $138,000, what is the cost in British pounds?a. 201,000b. 84,965c. 71,642d. 119,998
Aug 14 2020A 24 ft column in a braced frame building is to be built into a wall in such a manner that it will be continuously braced in its weak axis direction but not about its str...
Jul 07 2020The theoretical foundations of qualitative and quantitative methods are very different, but many researchers believe both methods should be used in the research study to ...
Aug 09 2020Evaluating Alternative Investments Ellen Hays received a windfall from one of her investments. She would like to invest $100,000 of the money in Linwood Inc., which is o...
Aug 12 2021Identify errors in plural and possessive construction in the following sentences. Write the correct form in the space provided. Each sentence contains one error.Some mana...
Jun 15 2021Consider a system of two thin lenses one a biconvex lens and another biconcave lens The focal length of convex lens is cm and concave lens is The two lenses are separa...
Feb 14 2020Daoud and Salma Salem are a married couple. They both worked for a textile company for 30 years. At age 57, Daoud and age 52, Salma retired and moved to live in a small t...
Dec 06 2019Summary operating data for Loma Company during the current year ended April 30, 20Y6, are as follows: cost of goods sold, $7,500,000; administrative expenses, $750,000; i...
Apr 14 2020Review the chart of accounts in Ch 2. In Excel, create a four column chart of accounts for a fictitious company in your pathway. The company should be a sole proprietor...
Sep 17 2020