created logic for quote calculation