Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

#include #include #include #include using namespace std; struct time{ int hours; int minutes; string dayPeriod; time(){hours=0;minutes=0;} time(int h, int m, string dp){hours=h;minutes=m;dayPeriod=dp;} void sub(int m){

image text in transcribed

image text in transcribed

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

#include #include #include #include

using namespace std;

struct time{ int hours; int minutes; string dayPeriod;

time(){hours=0;minutes=0;} time(int h, int m, string dp){hours=h;minutes=m;dayPeriod=dp;}

void sub(int m){ hours -= m / 60; minutes -= m % 60; correct(); } void correct(){ int originalH = hours; if (minutes > 59){ minutes -= 60; hours++; } if (minutes

if( hours > 12){ hours -=12; } if (hours

if(hours == 11 && originalH == 12){ if(dayPeriod == "am") dayPeriod = "pm"; else dayPeriod = "am"; }

if(minutes 60 || hours 12) correct();

}

};

int main() {

bool keepGoing = true;

while(keepGoing== true){ string dayOfWeek =""; int thour =0, tminute=0; char colon; string dayPeriod=""; bool flag = true;

do{ if(flag == true) cout HH:MM : "; else{ cin.clear(); cin.ignore(10000,' '); cout HH:MM : "; }

try{ cin >> dayOfWeek; if(dayOfWeek == "DONE"){ keepGoing = false; flag = false; break; } cin >> thour >> colon >> tminute >> dayPeriod; } catch(...){ flag = false; break; }

std::transform(dayOfWeek.begin(), dayOfWeek.end(), dayOfWeek.begin(), ::tolower); std::transform(dayPeriod.begin(), dayPeriod.end(), dayPeriod.begin(), ::tolower);

if (dayOfWeek == "monday" || dayOfWeek == "tuesday" || dayOfWeek == "wednesday" || dayOfWeek == "thursday" || dayOfWeek == "friday" || dayOfWeek == "saturday" || dayOfWeek == "sunday"){

if(thour = 1) if (tminute = 0) if (colon == ':') if(dayPeriod == "am" || dayPeriod == "pm") flag = true; else flag = false; else flag = false; else flag = false; else flag = false; }else flag = false; }while(flag == false); if(dayOfWeek == "DONE"){ break; }

time classTime(thour, tminute, dayPeriod);

int travelTime = 35;

if(dayPeriod == "am" && (classTime.hours >9 || (classTime.hours == 9 && classTime.minutes == 30)) && (classTime.hours

time leaveTime(classTime.hours, classTime.minutes, classTime.dayPeriod); leaveTime.sub(travelTime);

if(leaveTime.hours >= 6 && leaveTime.hours

if(leaveTime.hours >= 7 && (leaveTime.hours

if(leaveTime.hours >= 4 && leaveTime.hours

cout

return 0; }

Objectives: The main objective of this assignment is to assess the student's ability to provide a complete Black-Box testing plan for a computer program. Description: In this assignment, you will need to design a complete Black-Box testing plan for the following program. A computer science student has to travel from home to ODU every day for class. After showing up to class late too many times due to traffic, the student made a program to tell him when he should leave the house. The time given depends on the class time and the day of the week. He came up with a few rules to make sure he gets to class on time. The normal drive time for this student is 30 minutes without traffic. He then gives himself 5 minutes to walk across campus to class from the parking lot. However, if he leaves home during the worst morning rush hour, from 6 AM - 7 AM on a weekday, he needs to add 20 minutes to his commute to account for traffic. If he leaves home during the regular morning rush hour, from 7 AM - 8 AM on a weekday, he needs to add 10 minutes to his commute to account for traffic. Mondays have the worst morning traffic, and he should instead add 30 minutes for 6 AM-7AM and 20 minutes for 7 AM - 8 AM. On Saturdays and Sundays the student needs to take a different route due to road construction. This adds 6 minutes of travel time. If he leaves during the afternoon rush hour on a weekday, traffic from 4-6PM should add 15 minutes of travel time. Traffic in the afternoon is worst on Thursdays, and should instead add 20 minutes of travel time. If the class is between 9:30 AM and 11 AM he needs to arrive 10 minutes earlier for walking time because the closest parking lots are all full. The program will read data from the screen in the following format: Day_of_the_week hours:minutes AM/PM e.g. Tuesday 12:45 AM Sunday 01:52 PM If the input is not in the correct format the program will prompt the user again for the input. The program is not case sensitive. The hours and minutes can be a single digit or two digits, but the minutes must be 2 digits. The program will keep asking for input and giving a time to leave the house until the user types DONE' in all capital letters. Task: You must design a complete Black-Box testing plan for the "what time should I leave the house to get to class on time? program. Your task is to apply what you have learned about black-box testing techniques to develop a full suite of test data for this program. Use the template file provided in the Instructions and supporting files on BlackBoard to organize your tests and test data. Test # Test Description Test Data Expected Result Actual Result Pass/Fail 1 (*@#%&! 1:00 PM Pass Test non alphanumeric characters for day of week Program will request input again Program recognized incorrect input. Asked again. Functional Coverage Tests Test # Test Description Test Data Expected Result Actual Result Pass/Fail 1 DONE Test that DONE will end program Program ends Program Ends Pass Boundary Values Tests Test # Test Description Test Data Expected Result Actual Result Pass/Fail 1 Test largest time value Sunday 12:59 PM 41 minutes before 12:18 PM 12:18 pm Pass Special Values Tests Test # Test Description Test Data Expected Result Actual Result Pass/Fail 1 (*@#%&! 1:00 PM Pass Test non alphanumeric characters for day of week Program will request input again Program recognized incorrect input. Asked again

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Samsung Galaxy S23 Ultra Comprehensive User Manual

Authors: Leo Scott

1st Edition

B0BVPBJK5Q, 979-8377286455

More Books

Students also viewed these Databases questions

Question

Approaches to Managing Organizations

Answered: 1 week ago

Question

Communicating Organizational Culture

Answered: 1 week ago