192k views
1 vote
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 8-hour shifts 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. Think about what values your program should accept for the number of widgets ordered. 1 10

1 Answer

4 votes

Answer:

#include <iostream>

#include "Widgets.h"

using namespace std;

int main()

{

Widgets Order;

int Num;

// Ask user for the number of widgets ordered

cout << "\\ Widgets time of completion program\\"

<< "---------------------------------------------------\\";

do

{

cout << "How many widgets have been ordered? ";

cin >> Num;

if (Num < 0)

{

cout << "Error! Invalid Order.\\"

<< "Widgets Ordered must be greater than 0.\\";

}

} while (Num < 0);

Order.numOfDays(Num);

return 0;

}

Step-by-step explanation:

User Rikard Olsson
by
5.3k points