#include "domain.h" #include "repository.h" #include "controller.h" #include "UI.h" #include #include #include #include UI::UI(){ this->_controller.add("Orange","123",100,true); this->_controller.add("Digi","124",200,false); this->_controller.add("Vodafone","125",300,true); } UI::~UI(){ } void UI::run(){ char option; while(true){ printf("1. Add bill\n"); printf("2. Show all bills\n"); printf("3. Show all paid bills\n"); printf("4. Exit\n"); option=fgetc(stdin); while (fgetc(stdin)!='\n'); switch(option){ case '1':{ char company_name[100]; char serial_number[100]; int sum; bool isPaid; printf("Company name: "); fgets(company_name,100,stdin); company_name[strlen(company_name)-1] = '\0'; printf("Serial number: "); fgets(serial_number,100,stdin); serial_number[strlen(serial_number)-1] = '\0'; printf("Sum: "); scanf("%d",&sum); printf("Is paid: "); std::cin>>isPaid; bool check = this->_controller.add(company_name,serial_number,sum,isPaid); if(check) printf("Bill added\n"); else printf("Bill not added\n"); break; } case '2':{ auto v = this->_controller.getBills(); for (Bill bill : v) std::cout<_controller.getPaidBills(); int sum=0; for (Bill bill : v){ sum+=bill.sum(); std::cout<