-3

I am trying to finish a Rental project that is due on the 7th of May, I had made so much progress in the customers and movies but what eluded me is to set up the Date.

what I am supposed to do is when the Theoretical customer or admin enters execute the rent, is set the current date, and the date three days into the future to represent how long the user have to keep that movie. I would also want to know if there is a way to take the total of days, and set up a calculation for Days*Priceper day (ex 3 * .33 = .99 cents, CHEAP! )

this is my coding so far

  LocalDate today = LocalDate.now();
    LocalDate threeDayslater = today.plus(3, ChronoUnit.DAYS);

    System.out.println("Today is : " + today);
    System.out.println("Date after three days : " + threeDayslater);
    float p2 = ChronoUnit.DAYS.between(today, threeDayslater);
    System.out.println("Date after 1 week : " + p2);
    float Price = 0.66f;

    double res = Math.floor(p2 * Price);

    System.out.println("the total price is " + res + "");

any and all help would be needed, please.

Let me make this clear, the reason why I am doing all of these questionable decisions is because I am relearning Java all over again because my professor decided that all of the students taking this class would take Netbeans, Java and My SQL, and I am breaking my heads over this language. so yeah I am using every reference I can to try to make this code work.

so please dont assume I am giving you a hard time.

1 Answers1

1

You shouldn't use float/double for currency. Use BigDecimal instead.

cbones4321
  • 46
  • 1
  • 2