Question

Widget Factory C++ programming

Hello. I don't know where to start on this one. Could you please help?

Design a class for a widget manufacturing plant. Assuming that 10 widgets can be produced each hour, the call object will calculate how many days it will take toproduce 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 beenordered 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.
1 0
Add a comment Improve this question Transcribed image text
Answer #1

Dear,
Here is the code

//Header file section
#include <iostream>
using namespace std;
class Widget
{
private://member variables
double now;
double nod;
public:
//Mutator function for widgets
void setWidgets(double w)
{
if(w>0)
{
now=w;
nod=now/160;
}
else
cout<<"Invalid number of widgets"<<endl;
}

//Accessor function for widgets
double getWidgets()
{
return nod;
}
};

int main()
{
Widget w;

double d;
cout<<"Enter the number of widgets"<<endl;
cin>>d;
w.setWidgets(d);
//Calculating the number of days it takes for
// given widgets number
cout<<"The number of days it take to produce "<<d
<<" widgetsis:"<<w.getWidgets()<<endl;
system("pause");
return 0;
}//end main

Hope this will help you..

answered by: Miley
Add a comment
Know the answer?
Add Answer to:
Widget Factory C++ programming
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • c++ program

    Define a class called token number that incorporates a token’s number (could be the last 3 digits of your arid number) and its location. Number each token object as it is created. Use two variables of the angle class to represent the token’s latitude and longitude. A member function of the token class should get a position from the user and store it in the object; another should report the serial number and position. Design a main() program that creates three token, asks the user to input the position of each, and then displays each token’s number and position.

  • In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a...

    In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a program that asks the user to enter an integer value. Your program will then display that integer back to the user. Your program should include a function called getInteger that requests an integer value from the user and returns that value back to the caller. Your main () function will call the function getInteger and will then display the value returned by that function....

  • In C++, Please help me compute the following flowchart exactly like this requirement: Use while loops...

    In C++, Please help me compute the following flowchart exactly like this requirement: Use while loops for the input validations required: number of employees(cannot be less than 1) and number of days any employee missed(cannot be a negative number, 0 is valid.) Each function needs a separate flowchart. The function charts are not connected to main with flowlines. main will have the usual start and end symbols. The other three functions should indicate the parameters, if any, in start; and...

  • this is c plus plus the middletown wholesale copper wire company sells spools of copper wiring...

    this is c plus plus the middletown wholesale copper wire company sells spools of copper wiring for 100 each and ships them for 10 a piece. write a program that displays the status of an order. it should use two functions in addition to function main(). the first function asks for the following date and stores the input values in reference parameters. the number of spools ordered. the number of spools in stock. Any special shipping and handing charges. the...

  • The managers of the Frigid Midget Widget (FMW) Company, makers of small frozen widgets, have listed...

    The managers of the Frigid Midget Widget (FMW) Company, makers of small frozen widgets, have listed the tasks that must be completed to assemble one midget frigid widget (see following table). The managers must decide how large a crew to assign to each task; the size of the crew will determine the duration of the task (generally, there is an inverse relationship between crew size and job duration). Each job can be assigned a crew of minimum size, normal size,...

  • the code is in visual basic 376 Chapter 6 Loop Structures Case Programming Assignments con Most...

    the code is in visual basic 376 Chapter 6 Loop Structures Case Programming Assignments con Most Rainfall in the USA USE CASE DEFINITION e Windows application opens with the heading "Most Rainfall in US - Kauai," a ListBox object that displays the monthly rainfall amounts, an i amounts in inches mage, and a Button object that allows the user to begin entering their rainfall 2. A menu bar displays the File menu, which has two menu items: Clear and Exit....

  • A Plant Manager who has worked for a manufacturing facility for 32 years operates the plant...

    A Plant Manager who has worked for a manufacturing facility for 32 years operates the plant as follows: •Two eight (8) hour shifts per day •Two 10-minute breaks per shift •10 minute clean-up allowed each shift •Unpaid 30 minute lunch •10,000 pieces of inventory •95,000 packages are shipped 20 days per month •2 day lead time for all material •5 minute clean up before lunch •5 minute lag after Lunch •15 minute meeting at start of each shift Help this...

  • Is Prime Number In this program, you will be using C++ programming constructs, such as functions....

    Is Prime Number In this program, you will be using C++ programming constructs, such as functions. main.cpp Write a program that asks the user to enter a positive integer, and outputs a message indicating whether the integer is a prime number. If the user enters a negative integer, output an error message. isPrime Create a function called isPrime that contains one integer parameter, and returns a boolean result. If the integer input is a prime number, then this function returns...

  • Write a program that calculates the average number of days a company's employees are absent during the year and outputs a report on a file named "employeeAbsences.txt".

    Project DescriptionWrite a program that calculates the average number of days a company's employees are absent during the year and outputs a report on a file named "employeeAbsences.txt".Project SpecificationsInput for this project:the user must enter the number of employees in the company.the user must enter as integers for each employee:the employee number (ID)the number of days that employee missed during the past year.Input Validation:Do not accept a number less than 1 for the number of employees.Do not accept a negative...

  • In this program, you will be using C++ programming constructs, such as overloaded functions. Write a...

    In this program, you will be using C++ programming constructs, such as overloaded functions. Write a program that requests 3 integers from the user and displays the largest one entered. Your program will then request 3 characters from the user and display the largest character entered. If the user enters a non-alphabetic character, your program will display an error message. You must fill in the body of main() to prompt the user for input, and call the overloaded function showBiggest()...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT