programming

profilew.2.a
programming_project.docx

Programming project ;1

reate a class named Cylinder with a field for the radius. Be sure to include the following:

· a default constructor that sets the radius to 3

· a setter function to set the value of the radius

· a setter function to set the value of the height

· a getter function to return the value of the radius

· a getter function to return the value of the height

· a method to compute and return the cylinder’s surface area

Be aware that the surface area of a cylinder is 2 * pi * radius * radius + 2 * pi * radius * height.  Feel free to use the value of 3.14 for pi.

After creating this class, write a second class, TestCylinder, that creates an object with a radius of 10. It should also create a second Cylinder object that uses the radius set by the default constructor. Once the objects have been created, write code to display the surface area of both cylinders in an attractive fashion.

Submit both the Cylinder file and the TestCylinder file for grading.

Sample Session:

Please enter the radius:  5 Please enter the height:  8 The cylinder with a radius of 3 and height of 8 has a surface area of:  207.24 The cylinder with a radius of 5 and height of 8 has a surface area of:  408.20

Pls do the program in DEV++

Programming project 2:

(SavingsAccount Class) Create a SavingsAccount class. Use a static data member annual- InterestRate to store the annual interest rate for each of the savers. Each member of the class con- tains a private data member savingsBalance indicating the amount the saver currently has on deposit. Provide member function calculateMonthlyInterest that calculates the monthly interest by multiplying the balance by annualInterestRate divided by 12; this interest should be added to savingsBalance. Provide a static member function modifyInterestRate that sets the static an- nualInterestRate to a new value. Write a driver program to test class SavingsAccount. Instantiate two different objects of class SavingsAccount, saver1 and saver2, with balances of $2000.00 and $3000.00, respectively. Set the annualInterestRate to 3 percent. Then calculate the monthly in- terest and print the new balances for each of the savers. Then set the annualInterestRate to 4 per- cent, calculate the next month’s interest and print the new balances for each of the savers.

Again use dev++ to write the codes and the files