src/main/java/seedu/address/logic/commands/commandEdit/EditFinanceCommand.java
private static Finance createEditedFinance(Finance financeToEdit,
                                               EditFinanceDescriptor editFinanceDescriptor) {
        assert financeToEdit != null;

        Name updatedName = editFinanceDescriptor.getName().orElse(financeToEdit.getName());
        Date updatedDate = editFinanceDescriptor.getDate().orElse(financeToEdit.getDate());
        Amount updatedAmount = editFinanceDescriptor.getAmount().orElse(financeToEdit.getAmount());
        ID updatedCourseID = editFinanceDescriptor.getCourseID().orElse(financeToEdit.getCourseID());
        ID updatedStudentID = editFinanceDescriptor.getStudentID().orElse(financeToEdit.getStudentID());
        ID updatedTeacherID = editFinanceDescriptor.getTeacherID().orElse(financeToEdit.getStaffID());
        Set<Tag> updatedTags = editFinanceDescriptor.getTags().orElse(financeToEdit.getTags());

        // fields that cannot edit
        FinanceType updatedFinanceType = financeToEdit.getFinanceType();

        return new Finance(updatedName, financeToEdit.getId(), updatedFinanceType, updatedDate, updatedAmount, updatedCourseID, updatedStudentID, updatedTeacherID, updatedTags);
    }
/**
     * Creates and returns a {@code Finance} with the details of {@code financeToEdit} edited with
     * {@code editFinanceDescriptor}.
     */
Creates and returns a  Finance with the details of  financeToEdit edited with
editFinanceDescriptor.
Creates and returns a Finance with the details of financeToEdit edited with editFinanceDescriptor .
private static Finance createEditedFinance(Finance financeToEdit,
                                               EditFinanceDescriptor editFinanceDescriptor) {
        assert financeToEdit != null;
        Name updatedName = editFinanceDescriptor.getName().orElse(financeToEdit.getName());
        Date updatedDate = editFinanceDescriptor.getDate().orElse(financeToEdit.getDate());
        Amount updatedAmount = editFinanceDescriptor.getAmount().orElse(financeToEdit.getAmount());
        ID updatedCourseID = editFinanceDescriptor.getCourseID().orElse(financeToEdit.getCourseID());
        ID updatedStudentID = editFinanceDescriptor.getStudentID().orElse(financeToEdit.getStudentID());
        ID updatedTeacherID = editFinanceDescriptor.getTeacherID().orElse(financeToEdit.getStaffID());
        Set<Tag> updatedTags = editFinanceDescriptor.getTags().orElse(financeToEdit.getTags());
        FinanceType updatedFinanceType = financeToEdit.getFinanceType();
        return new Finance(updatedName, financeToEdit.getId(), updatedFinanceType, updatedDate, updatedAmount, updatedCourseID, updatedStudentID, updatedTeacherID, updatedTags);
    }
private static Finance createEditedFinance ( Finance financeToEdit , EditFinanceDescriptor editFinanceDescriptor ) { assert financeToEdit != null ; Name updatedName = editFinanceDescriptor . getName ( ) . orElse ( financeToEdit . getName ( ) ) ; Date updatedDate = editFinanceDescriptor . getDate ( ) . orElse ( financeToEdit . getDate ( ) ) ; Amount updatedAmount = editFinanceDescriptor . getAmount ( ) . orElse ( financeToEdit . getAmount ( ) ) ; ID updatedCourseID = editFinanceDescriptor . getCourseID ( ) . orElse ( financeToEdit . getCourseID ( ) ) ; ID updatedStudentID = editFinanceDescriptor . getStudentID ( ) . orElse ( financeToEdit . getStudentID ( ) ) ; ID updatedTeacherID = editFinanceDescriptor . getTeacherID ( ) . orElse ( financeToEdit . getStaffID ( ) ) ; Set < Tag > updatedTags = editFinanceDescriptor . getTags ( ) . orElse ( financeToEdit . getTags ( ) ) ; FinanceType updatedFinanceType = financeToEdit . getFinanceType ( ) ; return new Finance ( updatedName , financeToEdit . getId ( ) , updatedFinanceType , updatedDate , updatedAmount , updatedCourseID , updatedStudentID , updatedTeacherID , updatedTags ) ; }
Creates and returns a {@code Finance} with the details of {@code financeToEdit} edited with
 {@code editFinanceDescriptor}.
Creates and returns a { @code Finance } with the details of { @code financeToEdit } edited with { @code editFinanceDescriptor } .
// fields that cannot edit