TransitCalculator (help)

I was trying to create a method on TransitCalculator project and run it in the main method to see if it worked but I keep on getting the error that the main class could not be found or loaded. Please, Im new to coding and I need help:
Here is my code:

import java.util.Arrays;

public class TransitCalculator

{

int numDaysTransit;

int numRidesTransit;

String options = new String[3];

options["Pay-per-ride"];

options("7-day Unlimited Rides");

options("30-day Unlimited Rides");

double[] prices = new double[3];

prices[2.75];

prices[33.00];

prices[127.00]; 

public TransitCalculator(int numDays, int numRides)

{

numDaysTransit = numDays;

numRidesTransit = numRides;

}

public double unlimited7Price()

{

if(numDaysTransit%7 != 0)

{

  int numRoundedTransit = (numDaysTransit/7) + 1;

 double totalPrice = numRoundedTransit * 33.00;

 double finalPerPrice = totalPrice/numRidesTransit;

 return finalPerPrice;

}



  int nrt = numDaysTransit/7;

  double tp = nrt * 33.00;

  double fpp = tp/numRidesTransit;

  return fpp;

}

public static void main(String args)

{

TransitCalculator yanai = new TransitCalculator(19, 20 );

yanai.unlimited7Price();

System.out.println(yanai.unlimited7Price());

}

}

1 Like

Hi,

Thanks for sharing! I’ll try to help, but can you try reformatting your code so that all your code is under the </>. The way it looks now it’s hard to tell what’s happening.

Also, you can always practice the fundamental java lessons on Codecademy where they go over the main method.

Really appreciate it but I’ve already fixed the issue
Thanks.

1 Like

No problem. Glad you fixed it!