Ultimate Engineering Study Guide - Questions & Answers

[7.36 AM, 4/6/2023] Mas Fakkal: 2.5. Arcade (25%)You will also need to create a class to model an Arcade. This class should have fields for the arcade's name, a field for the revenue of the arcade, a collection of the arcade games that it of- fers, and and a collection of the customers that are registered with the arcade. The class should have a single constructor that takes a single argument for the arcade's name, and there should be methods to add individual customers and arcade games (e.g. addCustomer (Customer c)). Further, it should have accessor methods for the arcade's name and the revenue of the arcade, in addition to a suitable toString and evidence of testing.You should also provide methods for:getCustomer (String customerID) throws InvalidCustomerExceptiongetArcadeGame (String gameId) throws InvalidGameIDExceptionFinally, you should also have processTransaction (String customerID, String gameID, boolean peak) method which will be used to process a transaction when given a customer ID, product ID, and boolean to represent whether the transaction was carried out during peak time. This method should tie together what you have already implemented - it should retrieve the correct game, the correct customer, and then try to reduce that customer's balance by the appropriate amount. If successful, this amount should be added to the arcade's revenue amount and you should return true to indicate that the transaction was a success. Otherwise, the method should throw an appropriate exception for why the transaction not be successfully processed.[7.37 AM, 4/6/2023] Mas Fakkal: Additionally, Arcade Corp has asked that you provide the following methods: findRichestCustomer () which should search the customers that are registered at a specific arcade to return customer with the highest balance;7getMedianGamePrice() which will consider the price per game for all arcade games within this arcade and return the median (if there is an even number of games then this method should average the price of the two middle games);count ArcadeGames () which should return an int[] of size 3, where the first element is the number of cabinet games in this arcade, the second is the number of active games in this arcade (not including virtual reality games), and the third is the number of virtual reality games in this arcade;printCorporate Jargon () which should be a static method in the Arcade class that prints a message and does not return anything. It should simply print the corporate motto of "GreedyJayInc. and ArcadeCorp do not take responsibility for any accidents or fits of rage that occur on the premises".It is up to you to decide how you wish to store collections of products and customers. The simplest solution is to use arrays/ArrayList, but you can use any data structure that is im- plemented in Java (such as those that extend the Java Collection class or similar). A small number of additional marks will be awarded for using a more appropriate data structure than array-based collections, but only if the data structure used is indeed more appropriate and the choice of data structure is justified in the code with a short comment (i.e. why exactly is the data structure that you are using a better choice than an array/ArrayList). To be clear though, using an ArrayList or array will still lead to a good mark if implemented correctly.
This is Java Assignment. Add screenshot of execution. Please follow the instruction. And I need answer asap.Design a class named Person and its two subclasses named Student and Employee. Make Faculty and Staff subclasses of Employee. A person has the following attributes: name, address, phone number, and email address. A student has: class year (freshman, sophomore, junior, or senior) and major. An employee has: office (room number) and salary. A faculty member has: department the faculty belongs to and rank (assistant, associate, or full). A staff member has: role the staff member plays. Override the toString method in each class to have it return an appropriate value.Make sure you use the following appropriately:Visibility control: private, protected, and public for each field and method. Remember that you should not make every field protected blindly, right?super for both constructor and other methods such as toString.Write a test program (e.g., main in UsePerson.java) that creates an instance of each of the classes: Person, Student, Employee, Faculty, and Staff, and invokes at least their toString methods. Be sure to use subtyping as much as possible.This time, create an array of a certain type. I say "of a certain type" because I don't want to specify exactly what that type should be. What type you use would depend on what you want to do with the array. For example, you can do one of the following or something else that you come up with:Create an array of any of these classes and change the name in each object. If that is the case, you will want to make that type Person.Create an array of an appropriate type and be able to give a 10% raise to each object in the array. In that case you would create an array of the type Employee and populate the array with Employeeobjects, Faculty objects, Staff objects. Then, go through the array and give a raise.This time, add the usual: equals and compareTo if they make sense to be added. Make sure you did not add a getter and setter blindly for each field. You should add one of these only if it makes sense to add for each field.This time, go back to each class and add at least one more attribute (field) to each class, and make appropriate changes in the subclasses to cope with the new attribute being added. I am guessing that you can come up with a field that makes sense to be added to each class. If you are absolutely sure that there is no way another field can be added to a class, so be it.If you like, add two more classes: UndergradStudent and GradStudent as subclasses of Student and revise your program appropriately to deal with these additional classes. This part is not required, but you are strongly encouraged to try it.
C++Define a class called Shape. The shape class will hold different information about differentshapes. Specifically, each Shape object will contain: a letter to indicate the shape ('c' for circle, 's' for square, or 'h' for hexagon) one integer variable for the dimension needed (representing the radius of the circle, oneside of the square, or one side of the hexagon) a floating point value for area (used only internally - no accessors nor mutators needed)There should be the following member functions: a default constructor that has default values for the private member variables ('n' for theshape character and 0 for the dimension and area) accessors for the 3 private member variables, mutators for the character for shape and for the dimension a private member function that computes the area --- to be called whenever a constructoris used and whenever the dimension is changed using a mutator functionCreate a driver file that tests all functions and all computations for area. Code the test into yourfile, don't rely on user input!Overload the following operators for the Shape class: == checks to see if the types of shapes are the same and have the same dimension. NOTE: Youdo not have to check to make sure the areas are the same. += checks to make sure the types of shapes are the same, then changes the dimension of theoperand on the left of the operator to be the sum of the old dimension value of the left operandand the dimension of the right operand. The function should update the value of area. != returns true if the types of shapes are different or, if the same shape types, have dimensionvalues that are different + checks to make sure the shape types are the same. If they are, a new Shape object is created,its type set to the same type as the two operands to the right of the =, sets the dimension to thesum of the dimensions of the 2 operands, and computes the area (calling the helper function).Your program MUST include a test plan in the comments, detailing what values will be tested with eachoperator and what the output should be. Be sure to test your operators thoroughly.Be sure to prevent the user from trying to create a shape with a dimension