A large company with locations in different cities has taken an OOP approach in creating an...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
A large company with locations in different cities has taken an OOP approach in creating an administration program that manages all aspects of its business. These aspects include: the sale of all of the different products that the company manages the salaries for managers, office staff and sales personnel. ● 10. (a) By making use of an example from the above scenario, distinguish between a class and an instantiation of a class. The different modules in the program each open up a graphical user interface (GUI). Each GUI has a similar design, but contains differences specific to each module. (b) By giving two examples, explain how the principles of inheritance can be incorporated into the design of this administration program. (c) Describe how the use of libraries can facilitate the development of programs like this company's administration program. (Option D continues on the following page) [3] [4] [3] Activate Wir (Option D continued) Inpora 11. The company employs several sales personnel to sell its products to different retailers. Each branch of the company keeps track of its own sales with a suite of programs that include the two classes Sales Person and Sales. class Sales Person // each object contains details of one salesperson private String id; private Sales [] salesHistory; // details of the different sales private int count = 0; // number of sales made. //constructor for a new salesperson public Sales Person (String id) // code missing } // constructor for a salesperson transferred (together with // their sales details) from another branch public Sales Person (String id, Sales [] s, int c) } public int getCount() (return count; } public String getId() [return id;} public void setSalesHistory (Sales s) } // code missing } salesHistory [count] = s; count count + 1; public double calcTotalSales () // calculates total sales for the // salesperson // code missing public Sales largest Sale () // calculates the sale with the largest // value // code missing Each instance variable is initialized when a Sales Person object is instantiated. (a) Complete the constructor public Sales Person (String id), from the Sales Person class. (b) Explain why accessor methods are necessary for the Sales Person class. (Option D continues on the following page) [2] [3] (Option D, question 11 continued) class Sales // each object contains details of one sale { private String itemId; // id of the item private double value; // the price of one item private int quantity; // the number of the items sold // constructor missing public double getValue() (return value; } public int getQuantity () {return quantity; } (c) (i) Construct unified modelling language (UML) diagrams to clearly show the relationship between the Sales Person and Sales classes. Note: There is no need to include mutator or accessor methods or a constructor. (ii) Outline a negative effect that a future change in the design of the Sales object might have on this suite of programs. The company employs several sales personnel. The different sales Person objects are held in the array sales People. The Main class contains various methods that operate on the Sales Person and Sales classes. The array sales People is declared globally. The Main class contains the following code: Sales Person[] sales People - new Sales Person [6]; sales People [0] = new Sales Person ("100"); sales People [1] = new Sales Person ("101"); sales People [2] -new Sales Person ("102"); sales People [0].set SalesHistory (new Sales ("A100",300.00,10)); sales People [0].set Sales History (new Sales ("A200", 1000.00,2)); sales People [1] .setSalesHistory (new Sales ("A300",2550.40,10)); System.out.println (sales People [2].getId()); System.out.println (sales People [0].getCount()); System.out.println (sales People [1].getSalesHistory (0).getValue()); System.out.println (sales People [0].calcTotalSales ()); (d) State the output after running this code. (e) Construct the method calcTotalSales (), in the Sales Person class that calculates the total value of the sales for a specific Sales Person object. The sales People array contains 100 instantiated objects. The company wishes to reward the salesperson whose sales have the largest total value. (f) By making use of any previously written methods, construct the method highest (), that returns the ID of the salesperson whose sales have the largest total value. (Option D continues on the following page) [4] [2] [4] [5] [5] (Option D, question 11 continued) (g) Construct the method addSales (Sales s, String id), in the Main class, that will add a new Sales object s, to the salesperson with a specified ID. Note: You can assume that the ID is a valid one. A further class in this suite of programs is the Payroll class. This class is run at the end of each month to calculate each salesperson's salary, which is based on the sales that have been made during that month. (h) Suggest changes that must be made to the Sales Person class and/or the Sales class to allow these calculations to be made. (i) Discuss the use of polymorphism that occurs in this suite of programs. End of Option D naginoo art [4] [3] [3] A large company with locations in different cities has taken an OOP approach in creating an administration program that manages all aspects of its business. These aspects include: the sale of all of the different products that the company manages the salaries for managers, office staff and sales personnel. ● 10. (a) By making use of an example from the above scenario, distinguish between a class and an instantiation of a class. The different modules in the program each open up a graphical user interface (GUI). Each GUI has a similar design, but contains differences specific to each module. (b) By giving two examples, explain how the principles of inheritance can be incorporated into the design of this administration program. (c) Describe how the use of libraries can facilitate the development of programs like this company's administration program. (Option D continues on the following page) [3] [4] [3] Activate Wir (Option D continued) Inpora 11. The company employs several sales personnel to sell its products to different retailers. Each branch of the company keeps track of its own sales with a suite of programs that include the two classes Sales Person and Sales. class Sales Person // each object contains details of one salesperson private String id; private Sales [] salesHistory; // details of the different sales private int count = 0; // number of sales made. //constructor for a new salesperson public Sales Person (String id) // code missing } // constructor for a salesperson transferred (together with // their sales details) from another branch public Sales Person (String id, Sales [] s, int c) } public int getCount() (return count; } public String getId() [return id;} public void setSalesHistory (Sales s) } // code missing } salesHistory [count] = s; count count + 1; public double calcTotalSales () // calculates total sales for the // salesperson // code missing public Sales largest Sale () // calculates the sale with the largest // value // code missing Each instance variable is initialized when a Sales Person object is instantiated. (a) Complete the constructor public Sales Person (String id), from the Sales Person class. (b) Explain why accessor methods are necessary for the Sales Person class. (Option D continues on the following page) [2] [3] (Option D, question 11 continued) class Sales // each object contains details of one sale { private String itemId; // id of the item private double value; // the price of one item private int quantity; // the number of the items sold // constructor missing public double getValue() (return value; } public int getQuantity () {return quantity; } (c) (i) Construct unified modelling language (UML) diagrams to clearly show the relationship between the Sales Person and Sales classes. Note: There is no need to include mutator or accessor methods or a constructor. (ii) Outline a negative effect that a future change in the design of the Sales object might have on this suite of programs. The company employs several sales personnel. The different sales Person objects are held in the array sales People. The Main class contains various methods that operate on the Sales Person and Sales classes. The array sales People is declared globally. The Main class contains the following code: Sales Person[] sales People - new Sales Person [6]; sales People [0] = new Sales Person ("100"); sales People [1] = new Sales Person ("101"); sales People [2] -new Sales Person ("102"); sales People [0].set SalesHistory (new Sales ("A100",300.00,10)); sales People [0].set Sales History (new Sales ("A200", 1000.00,2)); sales People [1] .setSalesHistory (new Sales ("A300",2550.40,10)); System.out.println (sales People [2].getId()); System.out.println (sales People [0].getCount()); System.out.println (sales People [1].getSalesHistory (0).getValue()); System.out.println (sales People [0].calcTotalSales ()); (d) State the output after running this code. (e) Construct the method calcTotalSales (), in the Sales Person class that calculates the total value of the sales for a specific Sales Person object. The sales People array contains 100 instantiated objects. The company wishes to reward the salesperson whose sales have the largest total value. (f) By making use of any previously written methods, construct the method highest (), that returns the ID of the salesperson whose sales have the largest total value. (Option D continues on the following page) [4] [2] [4] [5] [5] (Option D, question 11 continued) (g) Construct the method addSales (Sales s, String id), in the Main class, that will add a new Sales object s, to the salesperson with a specified ID. Note: You can assume that the ID is a valid one. A further class in this suite of programs is the Payroll class. This class is run at the end of each month to calculate each salesperson's salary, which is based on the sales that have been made during that month. (h) Suggest changes that must be made to the Sales Person class and/or the Sales class to allow these calculations to be made. (i) Discuss the use of polymorphism that occurs in this suite of programs. End of Option D naginoo art [4] [3] [3]
Expert Answer:
Answer rating: 100% (QA)
a Distinguishing between a class and an instantiation of a class In the given scenario lets consider the Product class A class is a blueprint or template that defines the properties and behaviors of a ... View the full answer
Related Book For
Business Statistics For Contemporary Decision Making
ISBN: 978-1118749647
8th edition
Authors: Black Ken
Posted Date:
Students also viewed these programming questions
-
Googles ease of use and superior search results have propelled the search engine to its num- ber one status, ousting the early dominance of competitors such as WebCrawler and Infos- eek. Even later...
-
THIRD AVENUE SOFTWARE HEALTH-CARE APP PROJECT This case is new for the ninth edition of Information Technology Project Management . The case provides an opportunity to apply agile and Scrum...
-
Mount Everest is Earth's highest mountain above sea level, located in the Mahalangur Himal sub-range of the Himalayas. The ChinaNepal border runs across its summit point. Its elevation of 8,848.86 m...
-
Determine the place value of the digit 4 in each whole number. 1. 7640 2. 46,200,120 Discuss in detail.
-
Calculate the value for each of Exercises. 9 (8)
-
The plaintiff worked in a maintenance department for the defendant, a railway company, as a forklift operator. She was the only female worker in that department, and her supervisor repeatedly told...
-
The following selected events were experienced by either Knox Eldercare Services, Inc., a corporation, or Steve Knox, the major stockholder. State whether each event (1) increased, (2) decreased, or...
-
Other than the wind speed, what factor has the most impact on the amount of power generated by a wind turbine? Swept area of rotor Turbine style Terrain Blade material.
-
Dorsey Corporation purchased 90% of the common stock of Lansing Company on January 1, 2018. The cost of the investment was equal to the book value interest acquired. Lansing Company operates two...
-
An AC Current is an electric current whose flow oscillates sinusoidally. Suppose a particular AC current varies between 5 amps and -5 amps with a frequency of 60 cycles/s. If at time = 0.5s the...
-
Draw logic diagram for a . Nand Gate b . XOR Gate c . Half Adder d . y ( z + x )
-
As the CDO, you built your company's first data warehouse (DW) or a data lake (DL) How did your big data plans influence your choices in building your DW or DL?
-
If you deposit $1,500 at 7.59% annual interest rate, in how many years will the money in the bank account reach $6,800? (The answer may NOT be a whole number.) Round your answer to TWO decimal places.
-
The NOI is $40,000; there are $5,000 in tenant improvement expenditures paid for by the landlord; there is a $200,000 interest-only loan at 8 percent annual interest; the depreciable cost basis of...
-
Yesterday in the wheat futures market, the price of wheat decreased as did open interest. What was the dominant form of trading yesterday?
-
What does the balance of the Accumulated Depreciation account represent? The accumulation of funds needed to replace the assets at the end of their useful life The decline in value of plant assets...
-
Find an equation of the given line. Slope is -2; x-intercept is -2
-
A restaurant averages 4.51 customers per 10 minutes during the summer in the late afternoon. Shown here are Excel and Minitab output for this restaurant. Discuss the type of distribution used to...
-
The Manufacturing database associated with this text and found in Wiley PLUS has a variable, Value of Industrial Shipments that is coded 0 if the value is small and 1 if the value is large. Using...
-
Work the following binomial distribution problems by using the normal distribution. Check your answers by using Table A.2 to solve for the probabilities. a. P(x = 12 | n = 25 and p = .60) b. P(x > 5...
-
A change in chromosome structure that does not involve a change in the total amount of genetic material is a. a deletion. b. a duplication. c. an inversion. d. none of the above.
-
The term endopolyploidy refers to the phenomenon of having a. too many chromosomes. b. extra chromosomes inside the cell nucleus. c. extra sets of chromosomes in certain cells of the body. d. extra...
-
Which of the following is a type of plasmid? a. F factor (fertility factor) b. R factor (resistance plasmid) c. Virulence plasmids d. All of the above are types of plasmids.
Study smarter with the SolutionInn App