Hello everyone I had a question and I'm stumped. This is a question I need help on and so far what i have down i'm getting errors.
Design a class for a widget manufacturing plant. Assuming that 10 widgets may be produced each hour, the class object will calculate how many days it will take to produce any number of widgets. (The plant operates two shifts of eight hours each per day.) Write a program that asks the user for the number of widgets that have been ordered and then displays the number of days it will take to produce them.
INPUT VALIDATION: DO NOT ACCEPT NEGATIVE VALUES FOR THE NUMBER OF WIDGETS ORDERED.
what i hav eso far is this::::::>>>>>>>>>>>>>
#include <iostream>
using namespace std;
class widget
{
private:
double now;
double nod;
public:
void setWidgets(double w)
{
if(w>0)
{
now=w;
nod=now/160;
}
else
cout<<"Invalid number of widgets"<<endl;
}
double getwidgets()
{
return nod;
}
};
int main()
{
widget w;
double d;
cout<< "Enter the number of widgets"<<endl;
cin>> d;
w.getWidgets(d);
cout<< "The number of days it takes to produce " << d<< "widgets is: " << w.getwidgets(d)<<endl;
return 0;
}
While there is lots of room for improvement, just to get it to work so you can start improving it, change the first call w.getWidgets(d); to w.setWidgets(d); and change the second call to w.getWidgets();
I have already but i keep getting the same errors...LNK2001 unresolved external symbol & LNK1120 1 unresolved externals...I AM LOST COMPLETELY AND FRUSTRATED....
This is the hardest part about learning to program, figuring out the errors... If you are using visual studio, make sure you are trying to run it as a console and not windows. Properties-> Linker->system->subsystem->console