I was wondering if someone can help me with how to convert my code so that it converts the cents to dollars and also round to the nearest cent:
public class Subscription {
private int price;
private int length;
public Subscription(int p, int n) {
price = p;
length = n;
}
public double pricePerMonth() {
double r = ((double) price / (double) length); return r;
}
public void cancel() {
length = 0;
}
}
Any help would be most appreciated.