Question

In: Computer Science

C++ For a job, you need to schedule everything in life. There is personal life, hobbies...

C++

For a job, you need to schedule everything in life. There is personal life, hobbies and lots of other things, and work. You have to manage your time well. For your job, you have to work on projects early and probably every day. How much time would you need to spend to keep up with your work when you have other things in your life?

To solve this problem, write a C++ program to help you figure out how many hours a day you should work on the project to reach your goal of finishing a project by the on-time due date. This program should have two parts:

  1. Figure out how many days it will take to finish a project. To compute this, you need the following information from the user:
    1. The number of total hours you expect to work on the project
    1. The number of days until the project is due excluding holidays or days you’re unavailable
  2. You need to compute how many hours in a day you actually have available to work on the project. To compute this, you will need the info from the user:
    1. The number of hours per day you are unavailable (e.g. like hobbies or school), on average per day
    1. The number of hours you need on average per day for taking care of yourself. Example: eating, sleeping
    2. The number of extra hours spent each day like working out
    3. The number of hours you spend per day on other projects

Display the results from both of these calculations.

Then, compare them to find out if you have enough time each day to meet your goals. The program needs to show messages to alert the user of what’s going on.

After showing the results, allow the user to compute a new set of values until they want to end the program.

  • use a loop.
  • You must prompt the user for any input requested. Make sure it is clear from your prompts what the user is expected to do.
  • Don’t use any global variables
  • Make sure to use C++’s I/O (iostream library) for I/O
  • add comments and to work on your program’s readability
  • use clear variables

Solutions

Expert Solution

Here is the answer for your question in C++ Programming Language.

Kindly upvote if you find the answer helpful.

#####################################################################

CODE :

#include<iostream>

using namespace std;

double validateInput(double value);

int main(){
   //Required variables
   double expectedHrs,totalDaysDue,totalAvailableHrs;
   double unavailableHrs,selfCareHrs,workOutHrs,otherProjectHrs,availableHrsPerDay;
   const double totalHrsPerDay = 24;
  
   char choice = 'y';
  
   while(choice != 'n' && choice != 'N'){
       //Read expected hours
       cout << "Enter the number of total hours you expect to work on the project : ";
       cin >> expectedHrs;
       expectedHrs = validateInput(expectedHrs);
       //Read total days to work
       cout << "Enter the number of days until the project is due(excluding all leaves) : ";
       cin >> totalDaysDue;
       totalDaysDue = validateInput(totalDaysDue);
       //Read unavailable hours
       cout << "Enter the number of hours per day you are unavailable (due to hobbies,school etc.,) : ";
       cin >> unavailableHrs;
       unavailableHrs = validateInput(unavailableHrs);
       //Read self care hours
       cout << "Enter the number of hours you need on average per day for self care : ";
       cin >> selfCareHrs;
       selfCareHrs = validateInput(selfCareHrs);
       //Read extra hours
       cout << "Enter the number of extra hours spent each day : ";
       cin >> workOutHrs;
       workOutHrs = validateInput(workOutHrs);
       //Read other project hours
       cout << "Enter the number of hours you spend per day on other projects : ";
       cin >> otherProjectHrs;
       otherProjectHrs = validateInput(otherProjectHrs);
      
       //Calculate available hrs per day and total days
       availableHrsPerDay = totalHrsPerDay - (unavailableHrs + selfCareHrs + workOutHrs + otherProjectHrs);
       totalAvailableHrs = availableHrsPerDay * totalDaysDue;
      
       //Display output
       cout << "====================================" << endl;
       cout << "Your are expcted to work " << expectedHrs << " hours in " << totalDaysDue << " days." << endl;
       cout << "You are available for " << totalAvailableHrs << " hours, for " << totalDaysDue << " days." << endl << endl;
      
       if(totalAvailableHrs < expectedHrs){
           cout << "ALERT!!!YOU CANNOT ACHIEVE YOUR GOAL WITH THIS SCHEDULE" << endl;
       }else{
           cout << "COOL!!!YOU CAN ACHIEVE YOUR GOAL" << endl;
       }
      
       cout << endl << "Do you want to schedule again[Y/N]? ";
       cin >> choice;
   }
  
   return 0;
}
//Method to validate input
double validateInput(double value){
  
   while(value < 0 ){
       cout << "Input cannot be negative...Enter again : ";
       cin >> value;
   }
   return value;
}

###############################################################

SCREENSHOTS :

Please see the screenshots of the code below for the indentations of the code.

#####################################################

OUTPUT :

Any doubts regarding this can be explained with pleasure :)


Related Solutions

C++ For this question alone, put in everything (headers and so on) you need to make...
C++ For this question alone, put in everything (headers and so on) you need to make it compile. Assume the following functions have already been defined, write a main() that uses them to fill a vector with random integers, remove the smallest and largest integers from the vector, save the result in a file called "trimmed.txt" void fillRandom(vector & nums, int howMany); // fill with specified number of integers int minValue(vector nums); // return smallest value in vector int maxValue(vector...
When you are using Tally, everything you need is right there when you need it. You...
When you are using Tally, everything you need is right there when you need it. You can edit vouchers from within the Balance Sheet, change the Stock groups from within Stock Summary and so much more. It just operates the way you expect it to; this is such a delight to use, that you would almost feel like it’s made for you. Analyse the statement from your own experiences with the Tally software. (200 Words)
Discuss a practical application in your life for CVP. It can be personal, on the job,...
Discuss a practical application in your life for CVP. It can be personal, on the job, or a dream of starting your own business. Discuss the variable costs, and the fixed costs involved, and what it takes to break-even.
Please complete just Form 1040 (you do not need to fill out a Schedule C or...
Please complete just Form 1040 (you do not need to fill out a Schedule C or Schedule D, but you can use them to calculate numbers to enter into Form 1040) for a client with the following tax situation: Paul Gigornovich Address: 123 HillCrest Lane, San Diego, CA 92101 Wage income: $45,000/00 W2 Federal Tax Withholdings: $4,000.00 Net Long Term Stock Sales Gain: $8,000.00 Net Short Term Sock Sale Loss: -$12,000.00 Sole Proprietorship Business Gross Income: $80,000.00 Expenses: Interest: $8,000.00...
You now know everything you need to know to be an informed critic of the Affordable...
You now know everything you need to know to be an informed critic of the Affordable Care Act. Based on all that you have learned, how does the Act measure up to our three goals of 1) increasing quality of care, 2) increasing access to care and 3) keeping costs in check? In your answer, try not to veer into the political, but stay objective and non- partisan. Be specific about the provisions you’re referencing and the economic principle that’s...
******You do not need to get everything working exactly as it says, I mostly just need...
******You do not need to get everything working exactly as it says, I mostly just need an outline of how to create this GUI and add up the costs and print them all out. Any help at all will be greatly appreciated******* Design and implement a Java program that creates a GUI that will allow a customer to order pizza and other items from a Pizza Paarlor.  The customer should be able to order a variety of items which are listed...
How might the DMAIC be used in your personal life? In your dream job? (Min 400...
How might the DMAIC be used in your personal life? In your dream job? (Min 400 words)
Summarize Thermodynamics and everything you need to know/ important in a brief summary. (For physics)
Summarize Thermodynamics and everything you need to know/ important in a brief summary. (For physics)
C. Write your personal story following Purnell’s theory Questions you need to answer: 1. Heritage –...
C. Write your personal story following Purnell’s theory Questions you need to answer: 1. Heritage – tell me about you. 2. How do you communicate within your family? 3. Family dynamics / roles. Who makes decisions? 4. Work force issues – view of education. 5. Biology – skin color, specific body colors, textures – such as hair, or height 6. High risk behaviors – maybe a pattern in the family 7. View of nutrition and how you perceive your nutrition...
Apply the Job Dissatisfaction Model = Voice/Exit/Loyalty/Neglect model to a day to day personal life experience...
Apply the Job Dissatisfaction Model = Voice/Exit/Loyalty/Neglect model to a day to day personal life experience at work, home or university ASAP
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT