Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Black Box Testing (C++ Program) NEED HELP!! Fill in the information for each test that you develop for the 4 tables below. Add more rows

Black Box Testing (C++ Program) NEED HELP!!

Fill in the information for each test that you develop for the 4 tables below. Add more rows as required to list all possible tests for each type. Do not repeat tests which have already been used to test a particular description. Use as many rows as needed to capture all of your tests. Each of the four tables may span more than one page if necessary.

Representative Input Tests

Test #

Test Description

Test Data

Expected Result

Actual Result

Pass/Fail

1

Add a party

pizza Party

Saturday 12 pm

10 adults

10 teens

10 children

Cheese: 12 * 1, 14 * 2

Pepp: 12 * 1, 14 * 2

Saus: 12 * 1

Veggie: 14 * 2

Cheese: 12 * 1, 14 * 2

Pepp: 12 * 1, 14 * 2

Saus: 12 * 1

Veggie: 14 * 2

pass

2

Functional Coverage Tests

Test #

Test Description

Test Data

Expected Result

Actual Result

Pass/Fail

1

In menu, test that 3 exits the program

3

Program ends

Program Ends

Pass

Boundary Values Tests

Test #

Test Description

Test Data

Expected Result

Actual Result

Pass/Fail

1

Groups larger than 50

pizza Party

Saturday 12 pm

50 adults

0 teens

0 children

Starts with 18 pizzas

Cheese: 10 * 1, 18 * 3

Pepp: 18 * 3

Saus: 18 * 1

Veggie: 18 * 3

Mushr: 10 * 1

Pass

Special Values Tests

Test #

Test Description

Test Data

Expected Result

Actual Result

Pass/Fail

1

Negative values for number of Adult attendees

Adults = -1

Invalid entry

Invalid Entry, ReEnter

Pass

Design a complete Black-Box testing plan for the following program. A party planner needs a quick way of calculating certain distributions of food to order. In this instance, types, sizes, and number of pizzas to order for pizza parties. In their experience, the best distribution of type, and number of slices per person in order to make the most people happy at a party follows a number of rules:

Adults generally eat around 3 slices each.

Teens eat an average of 4 slices each.

Children typically eat 2 slices each.

If its a school night (Sunday Thursday) and the party is at 5pm or later, Adults tend to eat less and leave early. (The number of adults you need to buy pizza for can be reduced by a third.)

33% (1/3) of the total slices should be Cheese

Of the remaining 67%, 62% of the slices should be Meat.

o 75% of the meat slices should be Pepperoni

o 25% Sausage

Of the remaining 67%, 38% should be Veggie.

o 11% of the veggie slices should include Mushroom.

If the percentage value of slices for a type is less than 3 slices, no pizzas of that type will be ordered.

For each category of pizza (cheese, pepperoni, sausage, veggie and mushroom), determine the number and size of pizzas by starting with the largest size possible that is less than or equal to the total slices for that category.

o If you have 52 slices and the sizes start at 18 with 14 slices, it would be 3 18 pizzas, followed by the next size down whose number of slices is less than or equal to the remainder of slices.

If the remainder of slices for a pizza type is greater than 3, but smaller than the smallest pizza size in slices, then the smallest pizza size available will be added to the order for that type.

16 and 18 pizzas are reserved for parties with 50 or more attendees.

Pizza Sizes: o 10 6 slices o 12 8 slices o 14 10 slices o 16 12 slices o 18 14 slices

The program offers the ability to name a pizza party so that the calculation is saved for future reference. Past pizza parties can be viewed upon selection.

Here's the code for Black Box Testing:

PARTY.CPP:

#include "party.h" #include  #include  #include  int calcSlices(party& Party); ///prints party info void party::print(std::ostream& out){ std::string titles[10]={"Cheese","Pepperoni","Sausage","Veggie","Mushroom","10\"","12\"","14\"","16\"","18\""}; std::string days[7]={"Sun","Mon","Tues","Wed","Thur","Fri","Sat"}; out<12){ out<<'\t'<<"Time"<<"\t\t"<=50){ index = 4; } int che = 0.33*numSlices; int pepp = 0.75*(0.62*(numSlices-che)); int sau = (0.62*(numSlices-che))-pepp; int mush = 0.11*(0.38*(numSlices-che)); int vegg = (0.38*(numSlices-che))-mush; for(int i = index; i>0; i--){ while(che>=pizzaSizes[i]){ che=che-pizzaSizes[i]; Party.setCheese(1,i); } } if(che>2){ Party.setCheese(1,0); } for(int i = index; i>0; i--){ while(pepp>=pizzaSizes[i]){ pepp=pepp-pizzaSizes[i]; Party.setPepperoni(1,i); } } if(pepp>2){ Party.setPepperoni(1,0); } for(int i = index; i>0; i--){ while(sau>=pizzaSizes[i]){ sau=sau-pizzaSizes[i]; Party.setSausage(1,i); } } if(sau>2){ Party.setSausage(1,0); } for(int i = index; i>0; i--){ while(vegg>=pizzaSizes[i]){ vegg=vegg-pizzaSizes[i]; Party.setVeggie(1,i); } } if(vegg>2){ Party.setVeggie(1,0); } for(int i = index; i>0; i--){ while(mush>=pizzaSizes[i]){ mush=mush-pizzaSizes[i]; Party.setMushroom(1,i); } } if(mush>2){ Party.setMushroom(1,0); } } ///Reads from stream void party::readLine(std::istream& in){ getline(in, name, ':'); in>>adults>>teens>>children>>dayoftheWeek>>timeOfDay; for(int i=0; i<5; i++){ for(int j = 0; j < 5; j++){ in>>deets[i][j]; } } in.ignore(); } ///write instance to stream void party::writeLine(std::ostream& out){ out<= 17 && Party.getDayOftheWeek()<6){ numSlices += 3 * (00.6667 * Party.getAdults()); } else{ numSlices += 3 * Party.getAdults(); } numSlices += 4 * Party.getTeens(); numSlices += 2 * Party.getChildren(); return numSlices; } 

PARTY.H:

#ifndef __PARTY_H_INCLUDED__ #define __PARTY_H_INCLUDED__ #include  /// 3 slices per adult/ if its sunday thru thursday and 5pm or later, then adults probably won't stay long, so you only need enough for 2/3 the adults /// 4 slices per teen /// 2 slices per child /// 10" pizzas have 6 slices /// 12" pizzas have 8 slices /// 14" pizzas have 10 slices (most popular) /// 16" pizzas have 12 slices /// 18" pizzas have 14 slices /// 1/3 cheese /// 62% 0f 2/3 remaining slices are meat (75% of which is pepperoni, 25% sausage) /// 48% Of 2/3 reamining are veggie (11% of which is mushroom) /// if percentage values of number of slices are less than 1 large pizza, split into smaller pizzas /// once percentages are calculated, if the percentage is less than a slice, No pizzas of that type need to be ordered. /// if remaining slices are less than 5, no more pizzas need to be ordered of that type. /// 16" and 18" are reserved for parties over 50 class party{ std::string name; int adults; int teens; int children; int dayoftheWeek; int timeOfDay; int** deets; public: party(){ name = ""; adults=0; teens=0; children=0; dayoftheWeek=0; timeOfDay=0; deets = new int*[5]; for(int i=0; i<5; i++){ deets[i] = new int[5]; } for(int i=0; i<5;i++){ for(int j=0; j<5; j++){ deets[i][j]=0; } } /* adults teens children ten twelve fourteen sixteen eighteen cheese pepperoni sausage veggie mushroom dayoftheWeek timeOfDay */ }; ~party(){ delete deets; } void print(std::ostream& out); void printName(std::ostream& out); void readLine(std::istream& in); void writeLine(std::ostream& out); void setName(std::string Name){ this->name = Name; } std::string getName(){ return name; } void setAdults(int adults){ this->adults=adults; } int getAdults(){ return adults; } void setTeens(int teens){ this->teens=teens; } int getTeens(){ return teens; } void setChildren(int children){ this->children=children; } int getChildren(){ return children; } void setCheese(int num, int pieIndex){ deets[0][pieIndex]+=num; } int getCheese(int pieIndex){ return deets[0][pieIndex]; } void setPepperoni(int num, int pieIndex){ deets[1][pieIndex]+=num; } int getPepperoni(int pieIndex){ return deets[1][pieIndex]; } void setSausage(int num, int pieIndex){ deets[2][pieIndex]+=num; } int getSausage(int pieIndex){ return deets[2][pieIndex]; } void setVeggie(int num, int pieIndex){ deets[3][pieIndex]+=num; } int getVeggie(int pieIndex){ return deets[3][pieIndex]; } void setMushroom(int num, int pieIndex){ deets[4][pieIndex]+=num; } int getMushroom(int pieIndex){ return deets[4][pieIndex]; } void setDayOftheWeek(int day){ dayoftheWeek=day; } int getDayOftheWeek(){ return dayoftheWeek; } void setTimeOfDay(int time){ timeOfDay=time; } int getTimeOfDay(){ return timeOfDay; } int getTotalAttend(){ return adults+teens+children; } }; ///does all of the calculations and function calls to accomplish it void calcPizzas(party& Party); #endif // __PARTY_H_INCLUDED__

PizzaParty.CPP:

#include  #include  #include "party.h" using namespace std; bool menu(); void newParty(); void oldParty(); void addPartyToFile(party& Party); void printOldParties(party Party[], int numParty); int selectOldParty(party Party[], int numParty); inline bool fileExists (const string& name); int convert24(int hour, string period); int main() { bool flag=true; ///calls the menu in a loop until it returns false while(flag) { flag = menu(); if(flag){ cout<<" \tPress Enter to return to menu..."<>numParties; File.ignore(); party Parties[numParties]; for(int i=0; i>selection; if(!cin || !(selection>0 && selection<=numParty)){ cin.clear(); cin.ignore(); cout<<" Invalid Selection::: "; continue; } cin.clear(); cin.ignore(); break; } return selection-1; } ///checks the existence of a file and returns boolean inline bool fileExists (const std::string& name) { ifstream f(name.c_str()); return f.good(); } ///loads older parties and displays selected older parties to the user void oldParty(){ string filename= "pizzaParties.txt"; int numParties=0; ifstream inFile; if(!fileExists(filename)){ cout<<"No Old Parties Available"<>numParties; inFile.ignore(); party Parties[numParties]; for(int i=0; i>con; cin.ignore(256,' '); cin.clear(); if(con == 'y' || con == 'Y'){ continue; } break; } } ///create a new party plan void newParty(){ party Party; int temp=0; string tamp=""; while(true){ cout<<"Party Title: "; getline(cin, tamp); if(!cin){ cin.clear(); cin.ignore(256, ' '); cout<<" Enter a title ::: "; continue; } Party.setName(tamp); cin.clear(); break; } while(true){ cout<<"# of Adults attending: "; cin>>temp; if(!cin || temp < 0){ cin.clear(); cin.ignore(); cout<<" Enter an Integer >= 0 ::: "; continue; } Party.setAdults(temp); cin.clear(); cin.ignore(256, ' '); break; } while(true){ cout<<"# of Teens attending: "; cin>>temp; if(!cin || temp < 0){ cin.clear(); cin.ignore(256, ' '); cout<<" Enter an Integer >= 0 ::: "; continue; } Party.setTeens(temp); cin.clear(); cin.ignore(256, ' '); break; } while(true){ cout<<"# of Children attending: "; cin>>temp; if(!cin || temp < 0){ cin.clear(); cin.ignore(256, ' '); cout<<" Enter an Integer >= 0 ::: "; continue; } Party.setChildren(temp); cin.clear(); cin.ignore(256, ' '); break; } while(true){ cout<<"Day of the Week(1-7) 1 = Sunday: "; cin>>temp; if(!cin || !(temp < 8 && temp > 0)){ cin.clear(); cin.ignore(256, ' '); cout<<" Enter an Integer(1-7)::: "; continue; } Party.setDayOftheWeek(temp); cin.clear(); cin.ignore(256, ' '); break; } while(true){ cout<<"Around what Time of Day(example:1 pm): "; cin>>temp; cin>>tamp; if(!cin || !(tamp=="pm" || tamp=="am") || !(temp<13 && temp>0)){ cin.clear(); cin.ignore(256, ' '); cout<<" Invalid Input::: "; continue; } Party.setTimeOfDay(convert24(temp, tamp)); cin.clear(); cin.ignore(256, ' '); break; } calcPizzas(Party); addPartyToFile(Party); cout<<"++++++++++++++++++++Your Results+++++++++++++++++++++"<>select; if(!cin || select > 3 || select < 1){ cin.clear(); cin.ignore(); cout<<" Invalid Selection ::: "; continue; } cin.clear(); cin.ignore(); break; } switch(select){ case 1: newParty(); return true; case 2: oldParty(); return true; default: return false; } return true; }

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

Step: 3

blur-text-image

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

Privacy In Statistical Databases International Conference Psd 2022 Paris France September 21 23 2022 Proceedings Lncs 13463

Authors: Josep Domingo-Ferrer ,Maryline Laurent

1st Edition

3031139445, 978-3031139444

More Books

Students also viewed these Databases questions

Question

6. How do histories influence the process of identity formation?

Answered: 1 week ago