write my assignment 20772

Ex 8.4  (Rectangle Class) Create a class Rectangle with attributes length and width, each of which defaults to 1. Provide methods that calculate the rectangle’s perimeter and area. It has set and get methods for both length and width. The set methods should verify that length and width are each floating-point numbers larger than 0.0 and less than 20.0. Write a program to test class Rectangle.

Ex : 8.6 (Savings Account Class) Create class SavingsAccount. Use a static variable annualInterestRate to store the annual interest rate for all account holders. Each object of the class contains a private instance variable savingsBalance indicating the amount the saver currently has on deposit.Provide method calculateMonthlyInterest to calculate the monthly interest by multiplying the savingsBalance by annualInterestRate divided by 12—this interest should be added to savings- Balance. Provide a static method modifyInterestRate that sets the annualInterestRate to a new value. Write a program to test class SavingsAccount. Instantiate two savingsAccount objects, saver1 and saver2, with balances of $2000.00 and $3000.00, respectively. Set annualInterestRate to 4%, then calculate the monthly interest for each of 12 months and print the new balances for both savers. Next, set the annualInterestRate to 5%, calculate the next month’s interest and print the new balances for both savers.

Ex :8.14 (Date Class) Create class Date with the following capabilities:

a) Output the date in multiple formats, such as

MM/DD/YYYY

June 14, 1992

DDD YYYY

b) Use overloaded constructors to create Date objects initialized with dates of the formats

in part (a). In the first case the constructor should receive three integer values. In the

second case it should receive a String and two integer values. In the third case it should

receive two integer values, the first of which represents the day number in the year.

 
"Not answered?"
Get the Answer