![mianelson367](/avatars/40889.jpg)
mianelson367
25.04.2020 •
Engineering
Cashier Class SpecificationThe Cashier class represents a supermarket cashier. A cashier has a name (name instance variable), a total amount of money collected(total instance variable) after processing a number of items, a number of items processed (numberOfItems instance variable), and adescription of each item that was processed (allItemsScanned instance variable). The declaration of each variable follows.private String name;private int total, numberOfItems;private StringBuffer allItemsScanned;The class methods are:1. Constructor - Takes a string as parameter. The parameter represents the cashier’s name. It will initialize instance variablesaccordingly. The method assigns a StringBuffer object to the allItemsScanned instance variable. The method will throw (with any message) if the parameter is null or its length is less than 3.2. Copy Constructor - Creates a copy where changes to the copy will not affect the original.3. processItem - Takes as parameters a string representing an item, and an integer representing its price. It will append the string tothe allItemsScanned StringBuffer and will increase the number of items. No separator will be added (e.g., a comma). The totalinstance variable must be adjusted accordingly. The method will not modify the instance variables if the string parameter is null,if the string parameter is the empty string or if the price is negative. The method always returns a reference to the current object.No exception will be thrown by this method.4. getName - get method for name.5. getTotal - get method for total.6. getNumberOfItems - get method for numberOfItems.7. getAllItemsScanned - get method for allItemsScanned. You must avoid privacy leaks.8. compareTo - It has a Cashier as parameter and returns an integer. This method will return:a. A negative value if the total value of the current object is less than the parameter.b. A positive value if the total value of the current object is greater than the parameter.c. If the current object and the parameter have the same value for total, the method will return:i. A negative value if the number of items of the current object is greater than the parameter.ii. A positive value if the number of items of the current object is less than the parameter.iii. 0 otherwise.
Solved
Show answers
More tips
- H Health and Medicine What Makes a Man a Man?...
- C Computers and Internet How to Get Rid of Spam in ICQ?...
- A Art and Culture Who Said The Less We Love a Woman, the More She Likes Us ?...
- F Family and Home How to Get Rid of Your Neighbors?...
- S Society and Politics How Could Nobody Know About the Dead Mountaineers?...
- H Health and Medicine How to Cure Adenoids?...
- H Health and Medicine Why Wearing a Back Brace Can Be Beneficial During Back Strain?...
- S Sport When and Where Will the 2014 World Cup be Held?...
- C Computers and Internet How to Choose a Monitor?...
- H Horoscopes, Magic, Divination Where Did Tarot Cards Come From?...
Answers on questions: Engineering
- H Health Choose ONE (1) Mental Disorder and describe TWO (2) forms of therapy in your own words that do not have to do with medicine....
- E English Read the excerpt from On Becoming an Inventor by DeanKamen.What conclusion can be drawn from the details in thisexcerpt?I decided to put his entire machine shop in our basement,but...
- M Mathematics The boundary of a rectangular farm field in ireland has a straight rock wall along one side and fences along its other three sides. No fencing is necessary along the rock...
- B Business While filling out a survey, a respondent comes across a question that asks for respondent s annual income. There are five answer options and each option includes a range (e.g.,...
- S Social Studies Recent economic problems combined with a refugee crisis has led many countries to blame refugees for taking jobs and inciting terrorist activities. In this example, refugees...
- M Mathematics Using the equation y = 3x – 5, what would the output be for an input of -4?...
- H History Which most likely closely associated with American women gaining more economic opportunity and mobility in the mid- to late- 1800s? A) More women enrolled in colleges because...
- M Mathematics Which expression is equivalent to (3x + 6) + 4x?A) 3x + 10 B) 7x + 6 C) 12x + 6 D) 13x...
- B Business Sara is the CEO of a small entrepreneurial firm that creates medical software. She decided early on to create a company culture that supports innovation among her staff. Every...
- C Chemistry In lab, you add 2.141 g salicylic acid to a 125 mL Erlenmeyer flask, as listed in the procedure. You carefully add 4.0 mL acetic anhydride and have your TA add 5 drops of...
Ответ:
Speed = 44.9 mil/hr
Density = 23.109 pe/mi/hr
Level of service = 1271.04
Explanation:
See the attached files for the calculation