-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPaymentTotal.h
More file actions
30 lines (21 loc) · 796 Bytes
/
Copy pathPaymentTotal.h
File metadata and controls
30 lines (21 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
//Austin Nguyen
#ifndef PAYMENTTOTAL_H
#define PAYMENTTOTAL_H
#include "Payment.h"
#include <string>
class PaymentTotal
{
public:
// Calculates number of nights between check-in and check-out
static int calculateNights(const Payment& p);
// Calculates final total (base rate * nights * discount * tax * currency)
static float calculateFinalTotal(const Payment& p);
// Full processing, sets status + total price inside Payment object
static void processPayment(Payment& p);
private:
// Converts YYYY-MM-DD string into separate year/month/day variables
static void extractDate(const std::string& date, int& y, int& m, int& d);
// Converts year-month-day to a rough day count (simple formula)
static int dateToDays(int y, int m, int d);
};
#endif