Question: JAVA PROGRAMMING. Need help with this homework, thank you in advance! (25) 1 Design a class named Account that contains: A private int data field
JAVA PROGRAMMING. Need help with this homework, thank you in advance!


(25) 1 Design a class named Account that contains: A private int data field named id for the account (default o). A private double data field named balance for the account (default o). A private double data field named annuallnterestRate that stores the current interest rate (default O). Assume all accounts have the same interest rate. A private Date data field named date Created that stores the date when the account was created. A no-arg constructor that creates a default account. A constructor that creates an account with the specified id and initial balance. The accessor methods for id, balance, date Created and annuallnterestRate. A method named getMonthlyInterestRate() that returns the monthly interest rate. A method named withdraw that withdraws a specified amount from the account. A method named deposit that deposits a specified amount to the account. A method named toString that assembles all properties of an account in a string suitable for display on a dialog box with heading and labels and returns that string. Draw the UML diagram for the class. Implement the class. Write a test program that creates an Account object with an account ID of 1122, a balance of $20,000, and an annual interest rate of 4.5%. Use the withdraw method to withdraw $2,500, use the deposit method to deposit $3,000, and display the balance, the monthly interest, and the date when this account was created. (25) 2. In an n-sided regular polygon all sides have the same length, and all angles have the same degree (i.e., the polygon is both equilateral and equiangular). Design a class named RegularPolygon that contains: A private int data field named n that defines the number of sides in the polygon with default value 3. A private double data field named radius that stores the length of the radius of bounding circle with default value 1. A private double data field named X that defines the x-coordinate of the center of the polygon with default value 0. A private double data field named y that defines the y-coordinate of the center of the polygon with default value 0. A no-arg constructor that creates a regular polygon with default values. A constructor that creates a regular polygon with the specified number of sides and length of radius, centered at (0, 0). A constructor that creates a regular polygon with the specified number of sides, length of radius, and x-and y-coordinates. The accessor methods for all data fields. The method getPerimeter() that returns the perimeter of the polygon. . The method getArea() that returns the area of the polygon. The formula for computing the area of a regular polygon is: Side = 2 x radius * sin(T) Area =((n x radius?) X sin(2p))/2 A method named toString that assembles all properties of a regular polygon in a string suitable for display on a dialog box with heading and labels and returns that string. Draw the UML diagram for the class. Implement the class. Write a test program that creates three RegularPolygon objects, created using the no-arg constructor, using RegularPolygon(6, 4), and using RegularPolygon(10, 4, 5.6, 7.8). For each object, display its perimeter and area. https://www.mathsisfun.com/geometry/regular-polygons.html
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
