The programs must done using c++ language.The project must include a loop style
ID: 3599337 • Letter: T
Question
The programs must done using c++ language.The project must include a loop style menu which only close if the user decides to. The project will save the information to two different file types: txt and csv. Optional, the user must specify th path and name of the file. When printing in console the information should be readable and in tabular form. User entries must be validated always. All prgrams must use the concept of base class, inheritances, hierarchy, polymorphism, virtual functions, operator overloading, template class, at least two functions of the tempplate class must be overloaded. All the programs must handle datess using a class.
Project 1: Pharmacy Inventory Design and develop a program to manage a pharmacy inventory. This pharmacy handles three types of medications: over the counter medication, prescribed regular medication and prescribed controlled medication. Each medication has a price, it is stored in a bin numbered by letters and its name contains: name of medication, dosage and unit of measure Example of a medication: Children's Aspirin 25 MG located at bin BR-CN with a cost of $0.50 each milligram. Your program should include a main menu that allows the user to enter a new pharmacy item, search for pharmacy items containing a specific name, print all medications on inventory and edit an inventory item. Upon printing all medications items, the user can decide if it wants the list to be exported to a csv file (in which the user specifies the path), a txt file (in which the user specifies the path) or view on the console (print in console) All medication items have the date in which they were entered stored as part of their information. Upon searching the user must be able to select to search by name, by bin, or by entry date Upon edit, the user can update the name, the dosage and unit of the medication and the cost. By pressing this option the user can decide to cancel and not continue with the update or accept the changes. If the user accepts the changes the system will update the entry date to the new current date. The new location of bin must be updated. A medication can also be inactiveExplanation / Answer
Answer of choic 1 And Choice 3
#include<conio.h>
#include<fstream.h>
#include<iostream.h>
const int max = 100;
class Medication
{
public:
int type_of_medication;
char stored_bin[max];
char name_of_medication[max];
float dosage;
char unit_of_measure[max];
float cost;
};
void main()
{
clrscr();
char ans = 'Y';
char choice;
while(ans == 'Y' || ans == 'y')
{
clrscr();
cout<<" 1. Enter new inventory item";
cout<<" 2. Print";
cout<<" E. Exit";
cout<<" Enter choice : ";
cin>>choice;
switch(choice)
{
case '1':
clrscr();
Medication objMedication;
cout<<" Type of Medication : ";
cout<<" 1. Over the counter medication";
cout<<" 2. Prescribed regular medication";
cout<<" 3. Prescribed controlled medication";
cout<<" ****** Enter Type of medication : ";
cin>>objMedication.type_of_medication;
cout<<" Enter Stored Bin Name : ";
cin>>objMedication.stored_bin;
flush;
cout<<" Name of medication : ";
cin>>objMedication.name_of_medication;
flush;
cout<<" Dosage : ";
cin>>objMedication.dosage;
cout<<" Mesurement unit : ";
cin>>objMedication.unit_of_measure;
flush;
cout<<" Cost :";
cin>>objMedication.cost;
ofstream fout;
fout.open("D:\Med_Rec.txt",ios::app); //create or open file in append mode.
fout<<objMedication.type_of_medication;
fout<<" "<<objMedication.stored_bin;
fout<<" "<<objMedication.name_of_medication;
fout<<" "<<objMedication.dosage;
fout<<" "<<objMedication.unit_of_measure;
fout<<" "<<objMedication.cost<<" ";
fout.close();
break;
case '2':
ifstream in("D:\Med_Rec.txt");
if(!in)
{
cout<<"Can not open file";
}
else
{
char str[400];
cout<<" Type of medication";
cout<<" Store bin";
cout<<" Name of medication";
cout<<" dosage";
cout<<" Unit of measure";
cout<<" cost";
cout<<" ------------------------------------------------------------- ";
while(in)
{
in.getline(str,400);
if(in)
{
cout<<str<<endl;
}
}
in.close();
}
break;
case 'E':
case 'e':
goto exit;
}
flush;
cout<<" do you want to continue :";
cin>>ans;
}
exit:
getch();
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.