Skip to content

London | 26-Java-June | Pooriya Ketabi | Sprint 4 | Rental Summary Generator - #75

Open
PooriyaKTB wants to merge 3 commits into
CodeYourFuture:mainfrom
PooriyaKTB:Sprint-4-Rental-Summary-Generator
Open

PooriyaKTB wants to merge 3 commits into
CodeYourFuture:mainfrom
PooriyaKTB:Sprint-4-Rental-Summary-Generator

Conversation

@PooriyaKTB

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Changelist

Briefly explain your PR.

Questions

Ask any questions you have for your reviewer. You must remove this section if you have no questions.

@PooriyaKTB PooriyaKTB added 📅 Sprint 4 Assigned during Sprint 4 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 17, 2026
@jacknewman1995 jacknewman1995 self-assigned this Sep 4, 2026

@jacknewman1995 jacknewman1995 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

private final int customerAge;

public Customer(String firstName, String lastName, int customerAge) {
this.customerName = firstName + " " + lastName;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not store as two fields?


@Override
public String toString() {
return "RentalSummary{" +

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your IDEs generate tostring command might help here

summary.setTotalAmount(rentals.stream().map(Rental::getInterestAmount).reduce(0.0, Double::sum), contract.getCarPrice());
summary.setOutstandingAmount(rentals.stream().filter(r -> (r.getDueDate()).isAfter(today)).mapToDouble(r -> r.getCapitalAmount() + r.getInterestAmount()).reduce(0, Double::sum));
summary.setOutstandingCount(rentals.stream().filter(r -> (r.getDueDate()).isAfter(today)).count());
// summary.setSettled(rentals.stream().map(r -> r.getDueDate().isAfter(LocalDate.now())).findAny().isPresent());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commented out line?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. 📅 Sprint 4 Assigned during Sprint 4 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants