Question
786 Cattle Farm is a very well-known cattle farm of Pothowar Region. It maintains an excellent stock of different breed of cattle that are specially
786 Cattle Farm is a very well-known cattle farm of Pothowar Region. It maintains an excellent stock of different breed of cattle that are specially fed and taken care of for the purpose of Qurbani each year at the time Bakra Eid. The Description of Breed is as follows:
786 Cattle Farm
Breed Type Average Weight Description Price Stock Left
RS-1 130 Kg 2 Years 150 K 10 Cattle 5 for each year
150 Kg 3 Years 160 K
Ch-2 140 Kg 2 Years 160 K 14 Cattle 7 for eachyear
180 Kg 3Years 170 K
Th-1 190 Kg 2 Years 200 K 5 Cattle
Ka-2 160Kg 3 Years 190 K 18 Cattle 6 for each year
200 Kg 4 Years 200 K
220 Kg 5 Years 210 K
The Farm manger decided to design a program for selling the left cattle before Eid. The Program must have 2 type of users and provides the following functionality:
For Manager:
1. login() - to verify password stored in a file (pwd.txt)
2. store() - After authentication, to store data as an object of the above table on file(record.txt) including booking value as an integer (booking value is by default zero but when customer book some cattle it incremented by 1). You can use getData() function for getting input data from user and call it in store().
3. update() -After authentication, update Record on file if any cattle is booked (update [stock left value minus booking value] andchange booking value =0).
4. remainingCattles() - After authentication, Total remaining cattles of all types in a single number e.g Remaining=15
For Customer (login not required):
5. search() - for searching (Based on Type& Price for only left over cattles)
6. book_Cattle() - if available in the stock otherwise proper message for customer
Complete the class using C++ code and OOP concepts for the above design, main function is given for your help. In main function you have to write your Name and only where highlighted.
int main()
{
int option;
Farmf1;
do
{
system("cls");
cout<< " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&";
cout<< " \tWelcome to the 786 Catle Farm Program";
cout<< " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&";
cout<< " \tDeveloped by Your Name and Arid Number should be here";
cout<< " &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&";
cout<< " \tPress 1 for store data into file";
cout<< " \tPress 2 for update data in file";
cout<< " \tPress 3 for remainingCattles from file";
cout<< " \tPress 4 for search record in file";
cout<< " \tPress 5 for book cattlein file:";
cout<< " \tEnter Option:";
cin>> option;
switch (option)
{
case 1: f1.store();break;
case 2: f1.update();break;
case 3: f1.remainingCattles();break;
case 4: f1.search();break;
case 5: f1.book_Cattle();break;
}
cout<< " \tDo you want to continue...y/n:";
} while (_getche() == 'y');
cout<< " \tThanks for visiting 786 Cattle Farm!";
_getch();
return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started