function [user_answers] = input_questions() //This function asks the user numerous questions and returns the answers //to those questions which will be used to properly size the tiny house //and the various associated equipment. //tidy the workspace and clear previous variables clc; testA = %f; //Booleans used in the subsequent loops to obtain correct conditions testB = %f; //********Question 1*********************************************************** //********Question 1*********************************************************** //********Question 1*********************************************************** clc; disp('Question 1 - Trailer Length'); disp(' '); xcords = [10,30,38,38,30,30,30,10,10]; ycords = [0.2,0.2,0.2,8.5,8.5,0.2,8.5,8.5,0.2]; xcords2 = [10,34,42,42,34,34,34,10,10]; ycords2 = [10.2,10.2,10.2,18.5,18.5,10.2,18.5,18.5,10.2]; figure(1); plot(xcords,ycords,xcords2,ycords2); title('Example Diagram Showing Different Trailer Layouts'); isoview(0,70,0,20); //forces square axis on figure xlabel('Length of Trailer [ft]'); ylabel('Width of Trailer [ft]'); xstring(2,4,'Back') xstring(1,2,'of Trailer'); xstring(46,4,'Front'); xstring(45,2,'of Trailer'); xstring(55,4,'Square Feet:'); xstring(58,2,'238'); xstring(15,4,'Living Area'); xstring(14.7,2,'20ft Long'); xstring(31,5,'Sleeping'); xstring(32,3,'Area'); xstring(31,1,'8ft Long'); xstring(2,14,'Back') xstring(1,12,'of Trailer'); xstring(46,14,'Front'); xstring(45,12,'of Trailer'); xstring(55,14,'Square Feet:'); xstring(58,12,'272'); xstring(15,14,'Living Area'); xstring(15,12,'24ft Long'); xstring(35,15,'Sleeping'); xstring(36,13,'Area') xstring(35,11,'8ft Long'); h = gca(); h.data_bounds = [0,0; 70,20]; //set limits for x and y axes disp('The diagram in the graphics window shows how the trailer will be'); disp('divided. The upper 8ft gooseneck section will be devoted to a'); disp('sleeping area, and the lower section will be devoted to the living'); disp('space. The number entered will reflect the living space. (Graphics'); disp('window shown separately, and it will close automatically.)'); disp(''); disp('Press `Enter` after every entry for all questions.'); disp(''); while testA == %f //will keep looping until information is correct disp('What should the length of the living space (trailer) be?'); disp('Input must be 20 or 24 only (feet).'); disp(''); trailer_length_ft = input(''); disp(' '); if trailer_length_ft == 20 | ... trailer_length_ft == 24 testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(trailer_length_ft); disp(''); disp('as the living space length.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans as same ones are used in following questions testB = %f; close(figure(1)); //closes the trailer figure to clear up space //for the next question //********Question 2*********************************************************** //********Question 2*********************************************************** //********Question 2*********************************************************** clc; disp('Question 2 - Location of the Tiny House'); disp(' '); disp('This question is being asked to determine where the tiny house'); disp('will be located so the associated regional conditions can be'); disp('accounted for. The numbers 1 - 12 correspond to the following'); disp('cities. If the tiny house will be placed in a different city,'); disp('enter the number corresponding to a city with a similar climate.'); disp(''); while testA == %f //will keep looping until information is correct disp('Where will the tiny house be located?'); disp('Input must be either:'); disp(' 1 (Baltimore, MD), 7 (Miami, FL),'); disp(' 2 (Denver, CO), 8 (Nashville, TN),'); disp(' 3 (Fargo, ND), 9 (Phoenix, AZ),'); disp(' 4 (Grand Rapids, MI), 10 (Portland, ME),'); disp(' 5 (Houston, TX), 11 (Sacramento, CA), or'); disp(' 6 (Kansas City, MO), 12 (Seattle, WA)'); disp(''); city_num = input(''); disp(' '); if city_num == 1 | ... city_num == 2 | ... city_num == 3 | ... city_num == 4 | ... city_num == 5 | ... city_num == 6 | ... city_num == 7 | ... city_num == 8 | ... city_num == 9 | ... city_num == 10 | ... city_num == 11 | ... city_num == 12 testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); if city_num == 1 disp("(Baltimore, MD) ", city_num); elseif city_num == 2 disp("(Denver, CO) ", city_num); elseif city_num == 3 disp("(Fargo, ND) ", city_num); elseif city_num == 4 disp("(Grand Rapids, MI) ", city_num); elseif city_num == 5 disp("(Houston, TX) ", city_num); elseif city_num == 6 disp("(Kansas City, MO) ", city_num); elseif city_num == 7 disp("(Miami, FL) ", city_num); elseif city_num == 8 disp("(Nashville, TN) ", city_num); elseif city_num == 9 disp("(Phoenix, AZ) ", city_num); elseif city_num == 10 disp("(Portland, ME) ", city_num); elseif city_num == 11 disp("(Sacramento, CA) ", city_num); else disp("(Seattle, WA) ", city_num); end disp(''); disp('as the city number.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans as same ones are used in following questions testB = %f; //********Question 3*********************************************************** //********Question 3*********************************************************** //********Question 3*********************************************************** clc; disp('Question 3 - Number of Occupants'); disp(' '); disp('This question is being asked to determine how many people will be'); disp('occupying the space. People give off heat and consume water, so'); disp('knowing the number of occupants will help make the HVAC and water'); disp('calculations more accurate.'); disp(''); while testA == %f //will keep looping until information is correct disp('How many occupants will live in the tiny house?'); disp('Input must be either 1 or 2.'); disp(''); occupant_num = input(''); disp(' '); if occupant_num == 1 | ... occupant_num == 2 testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(occupant_num); disp(''); disp('as the number of occupants.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans as same ones are used in following questions testB = %f; //********Question 4*********************************************************** //********Question 4*********************************************************** //********Question 4*********************************************************** clc; disp('Question 4 - Number of Cell Phones (Smart Phones)'); disp(' '); disp('This question is being asked to determine how many devices will be'); disp('in the space. Each device gives off heat and consumes energy, so'); disp('knowing the number of overall devices will help make the HVAC and'); disp('energy calculations more accurate.'); disp(''); while testA == %f //will keep looping until information is correct disp('How many cell phones (smart phones) should be accounted for?'); disp('(for all occupants)'); disp('Input must be either 1, 2, 3, or 4.'); disp(''); cell_phone_num = input(''); disp(' '); if cell_phone_num == 1 | ... cell_phone_num == 2 | ... cell_phone_num == 3 | ... cell_phone_num == 4 testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(cell_phone_num); disp(''); disp('as the number of cell phones (smart phones).'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans as same ones are used in following questions testB = %f; //********Question 5*********************************************************** //********Question 5*********************************************************** //********Question 5*********************************************************** clc; disp('Question 5 - Number of Laptops'); disp(' '); disp('This question is being asked to determine how many laptops will be'); disp('in the space. Laptops gives off heat and consumes energy, so'); disp('knowing the number of overall laptops will help make the HVAC and'); disp('energy calculations more accurate.'); disp(''); while testA == %f //will keep looping until information is correct disp('How many laptops should be accounted for?'); disp('(for all occupants)'); disp('Input must be either 1, 2, 3, or 4.'); disp(''); laptop_num = input(''); disp(' '); if laptop_num == 1 | ... laptop_num == 2 | ... laptop_num == 3 | ... laptop_num == 4 testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(laptop_num); disp(''); disp('as the number of laptops.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans as same ones are used in following questions testB = %f; //********Question 6*********************************************************** //********Question 6*********************************************************** //********Question 6*********************************************************** clc; disp('Question 6 - Number of Pets'); disp(' '); disp('This question is being asked to determine how many pets will be'); disp('occupying the space. Pets, like people, give off heat and consume'); disp('water, so knowing the number of pets will help make the HVAC and'); disp('water calculations more accurate.'); disp(''); while testA == %f //will keep looping until information is correct disp('How many pets should be accounted for?'); disp('Input must be either 0, 1, or 2'); disp(''); pet_num = input(''); disp(' '); if pet_num == 0 | ... pet_num == 1 | ... pet_num == 2 testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(pet_num); disp(''); disp('as the number of pets.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans as same ones are used in following questions testB = %f; //********Question 7*********************************************************** //********Question 7*********************************************************** //********Question 7*********************************************************** clc; disp('Question 7 - Number of Plants'); disp(' '); disp('This question is being asked to determine how many plants will be'); disp('occupying the space. Plants consume water, so knowing the number'); disp('of plants will help make the water calculations more accurate.'); disp(''); while testA == %f //will keep looping until information is correct disp('How many plants should be accounted for?'); disp('Input must be either 0, 1, 2, 3, or 4'); disp(''); plant_num = input(''); disp(' '); if plant_num == 0 | ... plant_num == 1 | ... plant_num == 2 | ... plant_num == 3 | ... plant_num == 4 testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(plant_num); disp(''); disp('as the number of plants.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans as same ones are used in following questions testB = %f; //********Question 8*********************************************************** //********Question 8*********************************************************** //********Question 8*********************************************************** clc; disp('Question 8 - Is a Microwave Desired?'); disp(' '); disp('This question is being asked to determine if the occupant(s)'); disp('want a microwave in the tiny house. Microwaves give off heat and'); disp('consume energy, so knowing if one is wanted or now will help make'); disp('the HVAC and energy calculations more accurate.'); disp(''); while testA == %f //will keep looping until information is correct disp('Should a microwave be accounted for?'); disp('Input must be either `Yes` or `No`'); disp(''); microwave_y_or_n = string(input(' ','s')); disp(' '); if microwave_y_or_n == 'Yes' | ... microwave_y_or_n == 'YES' | ... microwave_y_or_n == 'yes' | ... //accepts multiple microwave_y_or_n == 'Y' | ... //yes answers microwave_y_or_n == 'y' microwave_y_or_n = 'Yes'; microwave_num = 1; testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(microwave_y_or_n); disp(''); disp('as wanting a microwave.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end elseif microwave_y_or_n == 'No' | ... microwave_y_or_n == 'NO' | ... microwave_y_or_n == 'no' | ... //accepts multiple microwave_y_or_n == 'N' | ... //no answers microwave_y_or_n == 'n' microwave_y_or_n = 'No'; microwave_num = 0; testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(microwave_y_or_n); disp(''); disp('as wanting a microwave.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans as same ones are used in following questions testB = %f; //********Question 9*********************************************************** //********Question 9*********************************************************** //********Question 9*********************************************************** clc; disp('Question 9 - Is a Washing Machine Desired?'); disp(' '); disp('This question is being asked to determine if the occupant(s)'); disp('want a washing machine in the tiny house. Washing machines consume'); disp('water and energy, so knowing if one is wanted or now will help make'); disp('the water and energy calculations more accurate.'); disp(''); while testA == %f //will keep looping until information is correct disp('Should a washing machine be accounted for?'); disp('Input must be either `Yes` or `No`'); disp(''); washing_mach_y_or_n = string(input(' ','s')); disp(' '); if washing_mach_y_or_n == 'Yes' | ... washing_mach_y_or_n == 'YES' | ... washing_mach_y_or_n == 'yes' | ... //accepts multiple washing_mach_y_or_n == 'Y' | ... //yes answers washing_mach_y_or_n == 'y' washing_mach_y_or_n = 'Yes'; washing_mach_num = 1; testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(washing_mach_y_or_n); disp(''); disp('as wanting a washing machine.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end elseif washing_mach_y_or_n == 'No' | ... washing_mach_y_or_n == 'NO' | ... washing_mach_y_or_n == 'no' | ... //accepts multiple washing_mach_y_or_n == 'N' | ... //no answers washing_mach_y_or_n == 'n' washing_mach_y_or_n = 'No'; washing_mach_num = 0; testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(washing_mach_y_or_n); disp(''); disp('as wanting a washing machine.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans as same ones are used in following questions testB = %f; //********Question 9a********************************************************** //********Question 9a********************************************************** //********Question 9a********************************************************** if washing_mach_num == 1; clc; disp('Question 9a - Number of Laundry Loads Per Week'); disp(' '); disp('This question is being asked to determine how many loads of laundry'); disp('should be accounted for per week. Laundry requires water so'); disp('knowing the number of loads per week will help make the water'); disp('calculations more accurate.'); disp(''); while testA == %f //will keep looping until information is correct disp('How many loads of laundry per week should be accounted for?'); disp('(for all occupants)'); disp('Input must be either 1, 2, 3, or 4.'); disp(''); laundry_num = input(''); disp(' '); if laundry_num == 1 | ... laundry_num == 2 | ... laundry_num == 3 | ... laundry_num == 4 testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(laundry_num); disp(''); disp('as the number of loads of laundry per week.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans as same ones are used in following questions testB = %f; else laundry_num = 0; testA = %f; //Reset booleans as same ones are used in following questions testB = %f; end ////////////////////// /////////////////////// ////////////////// //********Question 10********************************************************** //********Question 10********************************************************** //********Question 10********************************************************** clc; disp('Question 10 - Number of Showers Per Day'); disp(' '); disp('This question is being asked to determine how many showers should'); disp('planned for per day, accounting for all occupants. Showers consume'); disp('water, so knowing the number of showers per day will help make the'); disp('water calculations more accurate.'); disp(''); while testA == %f //will keep looping until information is correct disp('How many showers per day should be accounted for?'); disp('(for all occupants)'); disp('Input must be either 0, 1, 2, 3, or 4'); disp(''); shower_num = input(''); disp(' '); if shower_num == 0 | ... shower_num == 1 | ... shower_num == 2 | ... shower_num == 3 | ... shower_num == 4 testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(shower_num); disp(''); disp('as the number of showers per day.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans as same ones are used in following questions testB = %f; //********Question 11********************************************************** //********Question 11********************************************************** //********Question 11********************************************************** clc; disp('Question 11 - Is a Bathtub Desired?'); disp(' '); disp('This question is being asked to determine if the occupant(s)'); disp('want a bathtub in the tiny house. Bathtubs consume water so'); disp('knowing if one is wanted or now will help make the water'); disp('calculations more accurate.'); disp(''); while testA == %f //will keep looping until information is correct disp('Should a bathtub be accounted for?'); disp('Input must be either `Yes` or `No`'); disp(''); bathtub_y_or_n = string(input(' ','s')); disp(' '); if bathtub_y_or_n == 'Yes' | ... bathtub_y_or_n == 'YES' | ... bathtub_y_or_n == 'yes' | ... //accepts multiple bathtub_y_or_n == 'Y' | ... //yes answers bathtub_y_or_n == 'y' bathtub_y_or_n = 'Yes'; bathtub_num = 1; testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(bathtub_y_or_n); disp(''); disp('as wanting a bathtub.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end elseif bathtub_y_or_n == 'No' | ... bathtub_y_or_n == 'NO' | ... bathtub_y_or_n == 'no' | ... //accepts multiple bathtub_y_or_n == 'N' | ... //no answers bathtub_y_or_n == 'n' bathtub_y_or_n = 'No'; bathtub_num = 0; testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(bathtub_y_or_n); disp(''); disp('as wanting a bathtub.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans as same ones are used in following questions testB = %f; //********Question 11a********************************************************* //********Question 11a********************************************************* //********Question 11a********************************************************* if bathtub_num == 1 // only ask this question if the user wants a bathtub. clc; disp('Question 11a - Number of Baths Per Week'); disp(' '); disp('This question is being asked to determine how many baths should'); disp('planned for per week. Baths consume water, so knowing the number'); disp('of baths per week will help make the water calculations more'); disp('accurate.'); disp(''); while testA == %f //will keep looping until information is correct disp('How many baths per week should be accounted for?'); disp('(for all occupants)'); disp('Input must be either 1, 2, 3, or 4'); disp(''); bath_num = input(''); disp(' '); if bath_num == 1 | ... bath_num == 2 | ... bath_num == 3 | ... bath_num == 4 testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(bath_num); disp(''); disp('as the number of baths per week.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans as same ones are used in following questions testB = %f; else bath_num = 0; testA = %f; //Reset booleans as same ones are used in following questions testB = %f; end //********Question 12********************************************************** //********Question 12********************************************************** //********Question 12********************************************************** clc; disp('Question 12 - Number of Windows'); disp(' '); disp('This question is being asked to determine how many windows should'); disp('be accounted for. Windows reduce the energy efficieny of the tiny'); disp('house, so knowing the number of windows will help make the HVAC'); disp('calculations more accurate.'); disp(''); while testA == %f //will keep looping until information is correct disp('How many windows should be accounted for?'); disp('Input must be either 0, 1, 2, 3, 4, 5, or 6'); disp(''); window_num = input(''); disp(' '); if window_num == 0 | ... window_num == 1 | ... window_num == 2 | ... window_num == 3 | ... window_num == 4 | ... window_num == 5 | ... window_num == 6 testA = %t; testB = %f; while testB == %f clc; disp('You have input: '); disp(''); disp(window_num); disp(''); disp('as the number of windows.'); disp('Is this correct? (Please type `Yes` or `No`)'); disp(''); y_or_n = string(input(' ','s')); if y_or_n == 'Yes' | ... y_or_n == 'YES' | ... y_or_n == 'yes' | ... //accepts multiple y_or_n == 'Y' | ... //yes answers y_or_n == 'y' testB = %t; //returns true if input was correct elseif y_or_n == 'No' | ... y_or_n == 'NO' | ... y_or_n == 'no' | ... //accepts multiple y_or_n == 'N' | ... //no answers y_or_n == 'n' disp('Code will return to prompt for an updated input.'); tic; sleep(1500); //1.5 seconds toc; clc; testB = %t; //break out of inner while loop and //return to outer while loop testA = %f; //will reprompt if user wants to change answer else disp('Error, please type `Yes` or `No`.'); disp(' '); //reprompts for an input if anything else is entered end end else clc; disp('Error - Incorrect Input'); disp(' '); end end testA = %f; //Reset booleans testB = %f; user_answers = [trailer_length_ft; //1 city_num; //2 occupant_num; //3 cell_phone_num; //4 laptop_num; //5 pet_num; //6 plant_num; //7 microwave_num; //8 washing_mach_num; //9 laundry_num; //9a shower_num; //10 bathtub_num; //11 bath_num; //11a window_num;]; //12 endfunction