1. In the Walmart class, declare two instance variables, namely, total and count for calculating the total...
Question:
1. In the Walmart class, declare two instance variables, namely, total and count for calculating the total price and counting the number of items respectively. Then, create a no-argument constructor and assign 0.0 to the total.
2. Create a function named totalPrice that takes as input two arrays for item names and their prices and updates the total price and number of items. For each item, please do the following:
(a) Create a local variable "newTotal" to compute the updated value of the total;
(b) Assign the value of newTotal to the total variable and increment the count variable;
(c) Print the the values of total and count.
3. Make the Cashier class a Thread class by implementing the Runnable interface. In the Cashier class, please do the following:
(a) Declare an object named "objWalmart" of type "Walmart" class as an instance variable;
(b) Declare a string variable "name" for the cashier's name;
(c) Define a parameterized constructor that takes as input string for the cashier's name and object of
type "Walmart" and assigns them to the respective instance variables;
(d) Override the run method in which you will create two arrays, namely an array for item names, and
an array for the item price for the desired number of items through the Scanner class, and
call the totalPrice function through the instance variable objWalmart.
4. In the main function, please do the following:
(a) Create an object of the Walmart class;
(b) Create two objects of the Cashier class using parameterized constructor in which you pass the
above instance of Walmart and the cashier's name for each of the instances, respectively;
(c) Create two threads for each Cashier object, and start both the threads.
5. For this problem, you need to submit a document named "Lastname_Solution" describing the problems encountered while running Lastname_Thread class and respective solutions according to the following:
(a) When you run the Lastname_Thread, describe the issues in a document named
"LastName_Solution" if you have any. Add your solution for (a) in the document "LastName_Solution" and
implement the solution.
(b) Do you face any other problems? If yes, describe the problem in the document "LastName_Solution".
(c) If you have encountered any other problem in (b), then add your solution to the document
"LastName_Solution" andimplement the solution
Financial Reporting Financial Statement Analysis and Valuation a strategic perspective
ISBN: 978-1337614689
9th edition
Authors: James M. Wahlen, Stephen P. Baginski, Mark Bradshaw