Monday July 3, 2000


Consider the following exercises.

Exercise

Write a class call PMT that has one instance variable called n.

The class will have one public instance method called pi_of_x which accepts one int parameter and outputs the number of primes numbers less than or equal to that number.

The class will have another public instance method of type double called x_over_log_x which will accept as input one int parameter and output the result of the division of that number by its logarithm as a double.

The class will have another public instance method of type void called display that will print out a list. You will take a counter variable from 1 to n and display for each counter, the counter, the result of pi_of_x, and the result of x_over_log_x.

The constructor will accept one int parameter.
A Solution