Question

In: Computer Science

Here is my algorithm: Ask how much time they need to do the assignment(Total hours) Ask...

Here is my algorithm: Ask how much time they need to do the assignment(Total hours) Ask how many days are available Calculate hour per day needed Store time needed per day in a variable 2. How many hours per day are available Store hours available per day in a variable Ask user how much time is spent doing other things Calculate how much time is available per day 24- (# of hours not available) Display how much time is available per day Compare time available to time need per day to complete program If time available is greater than the time needed, Display message saying than they have enough time If time available is less than the time needed, Display message asking if the user wants, To try different values Display message saying that they do not have enough time Ask if the user wants to repeat with different values If yes, repeat End program.

Solutions

Expert Solution

Programming language used below: C++

Source Code:

#include <iostream>

using namespace std;

int main()
{
int total_hours, days_available, time_needed, time_spent, day_hour, time_left;
string s;

do
{
cout << "\nHow much time do you need to do the assignment (Total hours): ";
cin >> total_hours;
cout << "\nHow many days are available: ";
cin >> days_available;
time_needed = total_hours / days_available;

cout << "\nHow much time is spent doing other things: ";
cin >> time_spent;
day_hour = 24;
time_left = day_hour - time_spent;

cout << "\nHours available per day is: "<<time_left;

if(time_left > time_needed)
cout << "\n\nYou have enough time.";
else if(time_left < time_needed)
{
cout << "\n\nYou do not have enough time.";
cout << "\n\nDo you want to repeat with different values (Enter Y or N): ";
cin >> s;
}

}while(s == "y" || s == "Y");

return 0;
}

You can refer below for the screenshots of output:

Case 1:

Case 2:

Case 3:


Related Solutions

How much time does an algorithm take to solve a problem of size n if this...
How much time does an algorithm take to solve a problem of size n if this algorithm uses 2n2 + 2n operations, each requiring 10-8 seconds, with these values of n? a) 10: b) 20: c) 50: d) 100
What is the time complexity of my algorithm? It uses an vector E that contains and...
What is the time complexity of my algorithm? It uses an vector E that contains and object made of a string and an integer. It takes an empty vector as parameter and returns the vector with the top three integers from the objects in E . void Trendtracker::top_three_trends(vector<string> &T) {    T.clear();    if (E.size() == 0) {        return;    }    if (E.size() == 1) {        T.push_back(E[0].hashtag);    }    else if (E.size() == 2)...
The Influence of Advertising Time for an honest moment here, stop and think about how much...
The Influence of Advertising Time for an honest moment here, stop and think about how much advertising influences your consumption decisions. When is the last time you can remember choosing one product over another because of advertising? With this question being our starting point, it would be great to see if people can also address the following issues: What role does advertising play in influencing consumption in monopolistic competition? Does the impact of advertising allow for some price leverage by...
How do I get my program to ask the user to re enter the correct information...
How do I get my program to ask the user to re enter the correct information if the information entered does not match the database records? When I run my program it does let me know that the information entered does not match the database records but it does not ask me to enter the information again. Please add code (in bold) in the proper area with short explanation package MailMeSQL; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import...
How do I get my program to ask the user to re enter the correct information...
How do I get my program to ask the user to re enter the correct information if the information entered does not match the database records? When I run my program it does let me know that the information entered does not match but it does not ask me to enter the information again. package MailMeSQL; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; import java.util.Scanner; import com.mysql.cj.jdbc.JdbcConnection; public class mailmeMain {    public static void...
the half-life of a radioisotope 63 hours how much time will elapse if the radioisotope decays...
the half-life of a radioisotope 63 hours how much time will elapse if the radioisotope decays to one-fourth of its original mass?
Gwen had three accounts as listed here. In 2014, how much was her total coverage by...
Gwen had three accounts as listed here. In 2014, how much was her total coverage by the FDIC? Bank A: $295,000 Bank B: $55,000 Bank C: $295,000 Multiple Choice $55,000 $295,000 $555,000 $645,000 $895,000 What is the APY for a one-year $5,000 certificate of deposit with $825 interest? (Round your answer to 2 decimals.) Multiple Choice 8.25% 8.26% 10.31% 13.20% 16.50% What is the APY for a savings account with a $390 balance that receives $16 interest for the year?...
I DO NOT have a specific question, my question here is GENERAL HOW TO DETERMINE IF...
I DO NOT have a specific question, my question here is GENERAL HOW TO DETERMINE IF A COMPOUND IS POLAR OR NONPOLAR? I know how to figure about the number of valence electrons and I KNOW how to draw lewis structure, but then I just mess every thing up. I want to know how to determine if it's polar or not. for example: sicl2f2, co2, xef2, xeo4 ... I KNOW how to draw the lewis structure, but this I CANNOT...
How much time, on average, would a server need to spend on a customer to achieve...
How much time, on average, would a server need to spend on a customer to achieve a service rate of 8 customers per hour? (Round your answer to 2 decimal places.)
How much time on average would a server need to spend on a customer to achieve...
How much time on average would a server need to spend on a customer to achieve a service rate of 30 customers per hour? (round answer to 2 decimal places)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT