#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
	struct Date
	{
		int day, month, year;
	};
	struct Milk
	{
		string brandname;
		float price;
		Date expiredDate;
	};
	
	float sum = 0; // TO hold the total price of all milk
	float average = 0; // To hold the average price of all milk
	
	Milk milk[4];
	
	for (int i = 0; i < 4; i++)
	{
		cout << "Please enter the brandname of the milk: ";
		cin >> milk[i].brandname;
		
		cout << "Please enter the price of the milk: ";
		cin >> milk[i].price;
		
		sum += milk[i].price;
		
		cout << "Please enter the expired date of the milk: ";
		cin >> milk[i].expiredDate.day >> milk[i].expiredDate.month >> milk[i].expiredDate.year;
		
		cout << endl;
	}
	
	cout << setw(10) << left << "Brandname" << setw(10) << "Price(RM)" << setw(10) << "Expired Date" << endl;
	
	for (int j = 0; j < 4; j++)
	{
		cout << setw(10) << milk[j].brandname << setw(10) << setprecision(4) << milk[j].price << milk[j].expiredDate.day << "-" << milk[j].expiredDate.month << "-" << milk[j].expiredDate.year << endl;
	}
	
	average = sum / 4;
	
	cout << setw(10) << "Average" << setw(10) << average;
}
