Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A large company with locations in different cities has taken an OOP approach in creating an administration program that manages all aspects of its

A large company with locations in different cities has taken an OOP approach in creating an administration (Option D continued) Inpora 11. The company employs several sales personnel to sell its products to different (Option D, question 11 continued) class Sales // each object contains details of one sale { private String (Option D, question 11 continued) (g) Construct the method addSales (Sales s, String id), in the Main class,

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]

Step by Step Solution

3.43 Rating (153 Votes )

There are 3 Steps involved in it

Step: 1

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 ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Business Statistics For Contemporary Decision Making

Authors: Black Ken

8th Edition

978-1118494769, 1118800842, 1118494768, 9781118800843, 978-1118749647

More Books

Students also viewed these Programming questions

Question

Identify and briefly describe three forms of e-Government.

Answered: 1 week ago

Question

Where do you see yourself in 5/10 years?

Answered: 1 week ago

Question

What is job enlargement ?

Answered: 1 week ago

Question

what is the most common cause of preterm birth in twin pregnancies?

Answered: 1 week ago

Question

Which diagnostic test is most commonly used to confirm PROM?

Answered: 1 week ago

Question

What is the hallmark clinical feature of a molar pregnancy?

Answered: 1 week ago

Question

Find an equation of the given line. Slope is -2; x-intercept is -2

Answered: 1 week ago