Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PS: in java, using netbeans8.2 MyDate -int day -int month -int year // TO BE COMPLETED Person -name:String -address:String -email:String - bday:MyDate -phoneNumber:int // TO
PS: in java, using netbeans8.2
MyDate -int day -int month -int year // TO BE COMPLETED Person -name:String -address:String -email:String - bday:MyDate -phoneNumber:int // TO BE COMPLETED Bookstore -name:String -Address: String -PACI:int -employee[] : Employee -manager: Manager -sections: String //TO BE COMPLETED Book -title:String -ISBN: String -publisher:String -year:int -price:int -costPerCopy:int -nrOfPages:int -soldCopies:int -translatedLanguages[]: String // TO BE COMPLETED Author -genre: String -is Alive: boolean -death:MyDate -prizes [] String -books[): Books // TO BE COMPLETED Employee -id:string -joiningDate:MyDate -baseMonthlySalary:int -totalMonthlysales: int //TO BE COMPLETED Manager -yearlyBonus:int -officeNumber:int //TO BE COMPLETED Class MyDate (from assessment 2) Define all attributes and implement all the necessary getters and setters. Implement a full constructor MyDate(int day, int month, int year). Implement a method getFullDate () that returns the date in the following format: d-Month-yyyy (for example 10-Dec-2020). Class Book (from assessment2) Define all attributes the necessary getters and setters. Implement one empty constructor and one constructor that initializes all attributes from the parameters, except translatedLanguages. Instead, initialize translatedLanguages to an empty array with size 7. Implement a method calcSales() that will calculate and return the total sales from the sold books. Implement a method calcProfit() that will calculate and return the total profit made from the sold books. (Hint: the profit = sales - cost) Implement a method addLanguage(String lang) that will add a new language in the array of translatedLanguages, if the array is not full. If the addition of the language is successful, print a success message, otherwise notify the user that the array is full. Implement a method toString() that will return a String with all the information about the Book object. Class Bookstore(from assessment2) Define all attributes and all the necessary getters and setters. Implement an empty constructor. Implement a constructor that initializes name, address, paci, and manager. Initialize employee to an empty array of Employee with eight elements; initialize sections [] to an empty array of Strings with five elements. Implement a method toString() that returns a String with all the information about the bookstore. Implement a method addEmployee(Employee emp) that adds an employee in the array of employees if the array is not full. If the addition of the employee is successful, print a success message, otherwise notify the user that the array is full. Implement a method calcSalaryExpenses() that will calculate and return as an integer the sum of salaries of all employees and of the manager of the Bookstore. 2. Comparable Implement the comparable interface and declare the compareTo(): int method. Add the corresponding class diagram in the UML. 3. Person (partially from assessment 2) Implement the abstract class Person Define all attributes and all the necessary getters and setters. Implement an empty constructor and a full constructor. Implement a method calcAge() that will calculate and return the age of a person. Implement a method toString() that will return a String with all the information about the person. Implement an abstract method calcTotal(); 4. Class Author(partially from assessment 2) Define class author to inherit from class Person and to implement the comparable interface. Define all attributes and all the necessary getters and setters. Implement an empty constructor. Implement a constructor that initializes all the inherited attributes, genre and death attributes. In this constructor, initialize the prizes array to an empty String array of 10 elements and books to an empty Books array of 15 elements. If the death date is (0, 0, ), then the Author is still alive, therefore set the attribute isAlive to true; otherwise if the date is different, set the attribute is Alive to false. Implement a method addPrize(String prize) that will add a prize for the author in the array of prizes and print a success message. Check that the prizes array is not full; otherwise you have to print a warning message. Implement a method addBook(Book book) that will add a book in the array of Books and print a success message. Check that the books array is not full; otherwise you have to print a warning message. Update the method setDeath() to change the value of attribute isAlive to false, when the date of death changes. Implement a method calcAge(), that will calculate and return the age of a person. Hint: You need to check if the author is alive or has passed away. Implement a method calcTotal() that calculates and returns the worth of an author. The worth is: the sum of profits made from every book the author wrote (all the books in the books[] array) adding 100dkd for every prize in the prizes [] array. Implement the method compareTo() that will compare two authors based on the number of the prizes each one has received. 5. Class Employee(partially from assessment 2) Define class Employee to inherit from class Person and to implement the comparable interface Define all attributes and the necessary getters and setters. Implement an empty constructor. Implement a constructor that initializes all inherited attributes and, baseMonthlySalary, totalMonthlySales and joiningDate. Initialize id attribute to a random number of four integers (for example 5421). Implement a method toString() that will return a String with all the information about the employee. Implement a method addBonus(), that will calculate and return the updated baseMonthlySalary of the employee based on the employee's totalSales. If the totalMonthlySales are higher than 1000KD, the employee will get 100kd bonus. If the totalMonthlySales are higher than 500kd but less than or equal to 1000KD, then the employee will get 5SKD bonus. Otherwise, the employee gets no bonus at all. Implement a method calcEmployementPeriod() that calculates and returns as integer for how many years the employee has been working. Implement method calcTotal() that calculates and returns a rough prediction of the total salary of the Employee by considering the total updated salary for 5 years. Implement the method compareTo() that will compare two employees based their totalMonthlySale. 6. Class Manager(partially from assessment 2) Define class manager to inherit from class Employee. Define all attributes and the necessary getters and setters. Implement an empty constructor and a full constructor. Implement a method calcYearlySalary() that will calculate and return the salary including the yearly bonus, that the manager receives in a year. Implement a method toString() that will calculate and return a String with all the information about the manager. Implement method calcWorth() that calculates and returns a rough prediction of the worth of the Employee by considering the salary for 5 years. 7. Class TestMain Complete the following tasks in the main method: . Create four Employee Objects with some values of your choice. Print all the information for all employees. Print the Employment Period for each employee. Print the predicted worth of each employee. b. Create two Manager Objects with some value of your choice. Print all the information for all managers. Print the yearly salary for each manager. c. Create two Bookstore objects. Assigns two employees in bookstorel and the other two employees in bookstore2. Assign each bookstore one of the two managers created above. Print all the information for all bookstores. Print the expenses for each Bookstore. Compare the employees in each bookstore and print the result. d. Create 10 Book objects with some values of your choice. Print just the book titles and their respective prices. e. Create three author objects with some value of your choice. Assign 4 prizes to first author, 2 prizes to second author and 3 prizes to third author. Assign 2 books to the first author, 3 books to second author and 5 books to third author. Print all the information for these authors. Print the worth of every author. Compare author 1 and author 2. Compare author and author3. Print the result for each comparisonStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started