Assignment
1) Write a recursive function for generating a basic, infinite geometric series. As an example, from n = 1 to 4, it should generate the sum: 1/2 + 1/4 + 1/8 + 1/16.
Ensure your method has a working base and general case and returns the above sum (as a double). It should take any n greater than 0 as an input.
2) Trace the function you wrote above for input n = 5. (Refer to lecture notes for a trace reference, specifically the factorial example)
3) Overwrite the paintComponent method below, with the following constraints. If a string field called shape, which you have access to, has the value "Square," fill a red square that goes from point (50,100) to point (150,200). If the field has the value "Circle," draw a blue oval that goes from point (200,200) to point (400,400).
public void paintComponent(Graphics g){
4) You have been asked to write an application to help manage a pet store. Below are a list of requirements that the pet store have, as well as constraints that your client (i.e me) has specified for any software developed.
• Object Serialization should be used to save data (originally this was not going to be on the exam, but it is an easy way to save data, so I included it)
• The pet store must service at least three regular kinds of pets (e.g dog, cat, guinea pig), with a total of five pets served (the other two don't have to be "regular")
• The pet store interface must feature a GUI with a list of current animals for sale. Each animal for sale should specify the animal's name, species, and any other pertinent details:
o Example: Charlie the Cat is 5 years old. He has black fur.
• All Pets must belong to an inheritance hierarchy of some kind. An easy way to do this is to make a Pet class from which all kinds of Pets inherit
• The GUI must support the following operations
o Load Inventory - load a file of pet data to display in the store (let the user specify a file name)
o Save Inventory - save the current petstore data to a file (let the user specify a file name)
o Add a pet - Prompt the user for information to add a pet to the list of pets
o Sell a pet - Sell the pet currently selected in a JList on a GUI
• It is suggested saving and loading inventory go into a File menu
• The application should use polymorphism - that is, all lists should be lists of Pets (or Animals or whatever you call the class), rather than a list of type Dog, Cat, etc.
Format your assignment according to the following formatting requirements:
1. The answer should be typed, double spaced, using Times New Roman font (size 12), with one-inch margins on all sides.
2. The response also includes a cover page containing the title of the assignment, the student's name, the course title, and the date. The cover page is not included in the required page length.
3. Also include a reference page. The Citations and references should follow APA format. The reference page is not included in the required page length.