Lab Lesson 7 Part 2

 

Part of lab lesson 7

There are two parts to lab lesson 7. The entire lab will be worth 100 points.

Bonus points for lab lesson 7

There are also 10 bonus points. To earn the bonus points you have to complete the Participation Activities and Challenge Activities for zyBooks/zyLabs unit 10 (Gaddis Chapter 5). These have to be completed by the due date for lab lesson 7. For example, if you complete 89% of the activities you will get 8 points (there is no rounding).

Lab lesson 7 part 2 is worth 50 points

For part 2 you will have 40 points if you enter the program and successfully run the program tests. An additional 10 points will be based on the style and formatting of your C++ code.

Style points

The 10 points for coding style will be based on the following guidelines:

  • Comments at the start of your programming with a brief description of the purpose of the program.
  • Comments throughout your program
  • Proper formatting of your code (follow the guidelines in the Gaddis text book, or those used by your CS 1336 professor)
  • If you have any variables they must have meaningful names.

Development in your IDE

For lab lesson 7 (both parts) you will be developing your solutions using an Integrated Development Environment (IDE) such as Visual Studio, Code::Blocks or Eclipse. You should use whatever IDE you are using for your CS 1336 class. Once you have created and tested your solutions you will be uploading the files to zyBooks/zyLabs. Your uploaded file must match the name specified in the directions for the lab lesson. You will be using an IDE and uploading the appropriate files for this and all future lab lessons.

For this and all future labs the name of the source files must be:

lessonXpartY.cpp

Where X is the lab lesson number (7 for lab lesson 7) and Y is the part number (1 for part 1, 2 for part 2).

You will need to develop and test the program in your IDE. Once you are satisfied that it is correct you will need to upload the source file to zyBooks/zyLabs, and submit it for the Submit mode tests. If your program does not pass all of the tests you need to go back to the IDE, and update your program to fix the problems you have with the tests. You must then upload the program from the IDE to zyBooks/zylabs again. You can then run the tests again in Submit mode.

When running your program in Submit mode it is very important that you look at the output from all of the tests. You should then try and fix all of the problems in your IDE and then upload the updated code to zyBooks/zyLabs.

C++ requirements

  • The numbers need to be read in as type double. The calculations need to be done using type double as well.
  • You must properly handle end of file conditions.
  • You must properly open and close any files.

Failure to follow the C++ requirements could reduce the points received from passing the tests.

General overview

In this program you will be reading numbers from a file. You will validate the numbers and calculate the average of all of the valid numbers.

Your program will read in a file with numbers. The numbers will be of type double.

The numbers should be in the range from 0 to 105 (inclusive). You need to count all of the numbers between 0 and 105. You also need to calculate the average of these numbers. The average will be written out with four digits to the right of the decimal point.

If a number is not valid (that is, it is less than 0 or greater than 105) you need to count it (as a count of invalid values) and you need to write out the number to a file called “invalid-values.txt”. Values written to file invalid-values.txt should be in fixed format with five digits to the right of the decimal point.

As you did in lab lesson 7 part 1 you need to read in the input file name using cin. The prompt for the input file name is:

Enter input file name

You need to properly handle end of file conditions. See lab lesson 7 part 1 for details on reading files. Also see Demo of file input and output of data in this unit.

The output from your program will be written to cout. The output must contain the file being processed, the total number of values read in from the file, the number of invalid values read in, the number of valid values read in.

The last thing you need to output is either the average of the valid values or an error message. The average must have four digits of precision to the right of the decimal point and must be in fixed format. If there is not valid average you should output the message:

An average cannot be calculated

In what case would you display this message?

If the input file cannot be opened, you will need to output a message. Assume the input file name is badinput.txt and it cannot be opened. You will display the following error message to cout

File "badinput.txt" could not be opened 

Here is an example of a working program:

Assume the file name read in from cin is:

input.txt

and that input.txt contains:

-12
0
98.5
100
105.5
93.5
88
75
-3
111
89
-12

Your program would output the following:

Enter input file name
Reading from file "numbers.txt"
Total values: 12
Invalid values: 5
Valid values: 7
Average of valid values: 77.7143

The contents written out to file invalid-values.txt are:

-12.00000
105.50000
-3.00000
111.00000
-12.00000

You are reading from an input file and you are writing to an output file. Make sure you close both files after you are finished using them. You must do this in your program, you cannot just let the operating system close the files for you.

For tests where there is output written to an output file the contents of the output file will determine if you passed that test or not. For cases where you have written out to cout the tests will check the output sent to cout. In some cases output will be written to a file and to cout. When this is the case the test will be run twice with the same input. Once to test cout and once to test the contents of the output file. An example of this would be tests 2 and 3. Both use the same input file. Test 2 check the output written to cout and test 3 checks the output written to the file invalid-values.txt.

Failure to follow the requirements for lab lessons can result in deductions to your points, even if you pass the validation tests. Logic errors, where you are not actually implementing the correct behavior, can result in reductions even if the test cases happen to return valid answers. This will be true for this and all future lab lessons.

Expected output

There are eight tests. Some tests are parts 1 and 2 of one test. Test 1 uses an input file that contains only valid values. Test 2 tests an input file that does not exist. Test 3 and 4 each have two parts. The first part tests the output to cout and the second part tests the contents of the output file invalid-values.txt. The final two tests have just one part.

You will get yellow highlighted text when you run the tests if your output is not what is expected. This can be because you are not getting the correct result. It could also be because your formatting does not match what is required. The checking that zyBooks does is very exacting and you must match it exactly. More information about what the yellow highlighting means can be found in course “How to use zyBooks” – especially section “1.4 zyLab basics”.

Finally, do not include a system("pause"); statement in your program. This will cause your verification steps to fail.

Note: that the system("pause"); command runs the pause command on the computer where the program is running. The pause command is a Windows command. Your program will be run on a server in the cloud. The cloud server may be running a different operating system (such as Linux).

Web technology

Web design includes many different skills and disciplines in the production and maintenance of websites. In other words, you need to be sure that:

  1. You make the site easy, efficient, and delightful to use.
  2. You need to focus on the functional organization of the site’s pages and tools (buttons, links, menus…etc).
  3. Ensures that the site is favourable.

In your opinion and own words, How the above tasks can be achieved?

Question

 Data Gathering Instrument Task: Create one (1) instrument that could be used to gather data for your mock dissertation topic. The instrument should be designed to be exactly how it would be deployed to collect data. Since instrumentation usually goes through several steps of field testing, for purposes of this assignment you can submit a deployment-ready draft of your instrument without field testing it. Be sure the instrument collects data appropriately to measure your research question. If your study will not use an instrument to collect data because your data is archival and already exists, you will discuss your process for data retrieval.

Word Search Python

 

Create a python script that will load homework7WordSearchKey.txt and use it to create a word search puzzle, then save that as homework7WordSearchPuzzle.txt. The example of this part was done in class; you may use as much of that as you like as long as you ensure it works on your computer.

Create a second python script that will load your homework7WordSearchPuzzle.txt as well as homework7WordSearchList.txt, and then search the puzzle you’ve created and recreate the block from homework7WordSearchKey.txt.

The horizontal words should be almost trivial. The vertical words will require some careful thought on how to manipulate the strings, and/or how to load the data. There is a single diagonal word that will likely be the most challenging. 

Your code should be able to find words that are in the word list without knowing in advance which direction they are facing (though no words will be backward).

Given text file

homework7wordSearchKey.txt

       M        

  A   EXCEPTION      

  N     T        

 FLOAT    H        

  CHARACTER O        

  O     D   B I    

  N     OPERATOR N    

F  D        O T    

 U VARIABLE   J  LITERAL  

 N       U  E G    

  C      P  A E    

  T     PYTHONSTRING  

   I     T       

   O   SPYDER       

    N    R     

homework7wordSearchList

ANACONDA 

BOOLEAN  

CHARACTER

EXCEPTION

FLOAT   

FUNCTION 

INTEGER  

JUPYTER  

LITERAL  

METHOD  

SPYDER  

STRING  

OPERATOR 

PYTHON  

VARIABLE 

Assignment should be 3-4 paragraphs in length.

Go online and search for information about companies that have been harmed or bankrupted by a disaster. Choose one such company and create a brief case study about it. Successful narratives will focus on the manner in which the organization was impacted, including financial losses, losses of sales, or the need for layoffs. Your assignment should be 3-4 paragraphs in length.

SC_EX19_9b_FirstLastName_1.xlsx

  

* PROJECT STEPS

1. Takara Hiyashi is on the board of the Green Lake Sports Camp, a recreational summer camp in Syracuse, New York. She is using an Excel workbook to analyze the camp’s financials and asks for your help in correcting errors and solving problems with the data.
Go to the Teams worksheet. Takara asks you to correct the errors in the worksheet. Correct the first error as follows:

a. Use the Trace Precedents arrows to find the source of the #VALUE! error in cell C8.

b. Use the Trace Dependents arrows to determine whether the formula in cell C8 causes other errors in the worksheet.

c. Correct the formula in cell C8, which should add the baseball registration fee per person (cell C4) and the equipment fee (cell C7), and then multiply the result by the minimum number of campers (cell C6).

d. Remove the trace arrows.

2. Correct the Name error in cell C22 as follows:

a. Use any error-checking method to determine the source of the error in cell C22, which should calculate the average revenue per week.

b. Correct the error by editing the formula in cell C22.

3. Correct the divide by zero errors as follows:

a. Evaluate the formula in cell C18 to determine which cell is causing the divide by zero error.

b. Correct the formula in cell C18, which should divide the revenue per session (cell C16) by the minimum number of campers (cell C6).

c. Fill the range D18:G18 with the formula in cell C18. 

4. Takara suspects that the remaining divide by zero errors and the two negative values in the range E16:E18 are related to the zero value in cell E6. She wants to make sure that anyone entering the minimum number of campers enters a number greater than zero.
Add data validation to the range C6:G6 as follows:

a. Set a data validation rule for the range C6:G6 that allows only whole number values greater than 0.

b. Add an Input Message using Number of Campers as the Input Message Title and the following text as the Input message:
Enter the minimum number of campers for this session. 

c. Add an Error Alert using the Stop style, Campers Error as the Error Alert Title, and the following text as the Error message:
The minimum number of campers must be greater than 0. 

5. Identify the invalid data in the worksheet and correct the entry as follows:

a. Circle the invalid data in the worksheet.

b. Type 10 as the minimum number of campers for the lacrosse sessions (cell E6).

c. Verify that this change corrected the remaining divide by zero errors and resulted in positive values in the range E16:E18.

6. Go to the Private Lessons worksheet. This worksheet analyzes financial data for private and semi-private lessons, which the camp runs throughout the day. Takara has already created a scenario named Current Campers that calculates profit based on the current number of campers enrolled for each session. She also wants to calculate profit based on the maximum number of campers.
Add a new scenario to compare the profit with maximum enrollments as follows:

a. Use Max Campers as the scenario name.

b. Use the enrolled campers per day data (range C9:G9) as the changing cells.

c. Enter cell values for the Max Campers scenario as shown in bold in Table 1, which are the same values as in the range C8:G8.

* Table 1: Cell Values for the Max Campers Scenario

   

Cell

Value

 

Baseball_Campers (cell C9)

10

 

Basketball_Campers (cell D9)

12

 

Lacrosse_Campers (cell E9)

10

 

Soccer_Campers (cell F9)

12

 

Volleyball_Campers (cell G9)

15

7. Takara also wants to calculate profit based on the minimum number of campers.
Add another new scenario to compare the profit with low session enrollment as follows: 

a. Add a scenario to the worksheet using Min Campers as the scenario name.

b. Use the enrolled campers per day data (range C9:G9) as the changing cells.

c. Enter cell values for the Min Campers scenario as shown in bold in Table 2.

* Table 2: Cell Values for the Min Campers Scenario

   

Cell

Value

 

Baseball_Campers (cell C9)

8

 

Basketball_Campers (cell D9)

8

 

Lacrosse_Campers (cell E9)

7

 

Soccer_Campers (cell F9)

8

 

Volleyball_Campers (cell G9)

7

8. Show the Min Campers scenario values in the Private Lessons worksheet.

9. Go to the Revised Fees worksheet. Takara is considering whether to change the coaching fees for the private lessons. She has created three scenarios on the Revised Fees worksheet showing the profit with a $5 or $10 increase or a $5 decrease to the coaching fees.
Compare the average profit per session based on the scenarios as follows:

a. Create a Scenario Summary report using the average profit per session (range C11:G11) as the result cells to show how the average profit changes depending on the coaching fee changes. 

b. Use Revised Fees Scenario Report as the name of the worksheet containing the report.

10. Takara also wants to focus on one or two types of private lessons at a time when comparing the average profit per session. Return to the Revised Fees worksheet and create another type of report as follows:

a. Create a Scenario PivotTable report using the average profit per session (range C11:G11) as the result cells to compare the average profit depending on the fee changes in a PivotTable.

b. Use Revised Fees PivotTable as the name of the worksheet containing the PivotTable.

c. Format cells B4:F6 in the Revised Fees PivotTable worksheet using the Accounting number format with 0 decimal places and $ as the symbol.

11. Go to the Games worksheet. Takara wants to determine the number of games the camp can hold on Fridays and Saturdays to make the highest weekly profit without interfering with practices, which are also scheduled for Fridays and Saturdays and use the same resources.
Use Solver to find this information as follows:

a. Use the total weekly profit (cell H17, named Total_Weekly_Profit) as the objective cell in the Solver model, with the goal of determining the maximum value for that cell.

b. Use the number of Friday and Saturday games for the five sports (range C5:G6) as the changing variable cells.

c. Determine and enter the constraints based on the information provided in Table 3.

d. Use Simplex LP as the solving method to find a global optimal solution.

e. Save the Solver model in cell B27.

f. Solve the model, keeping the Solver solution.

* Table 3: Solver Constraints

   

Constraint

Cell or Range

 

Each game is scheduled at least once on   Friday and once on Saturday

C5:G6

 

Each Friday and Saturday game value is   an integer

C5:G6

 

Each sport is scheduled for a game 1   time per week or more

C7:G7

 

Each sport is scheduled for a game 3   times per week or less

C7:G7

 

The total number of Friday games is 10   or less

Total_Friday_Games (H5)

 

The total number of Saturday games is   15 or less

Total_Saturday_Games (H6)

 

The total number of games per week is   13

Total_Weekly_Games (H7)

 

The total number of Friday practices is   2 or less 

Friday_Practices (E21)

 

The total number of Saturday practices   is 2 or less

Saturday_Practices (E22)

 

The total number of practices per week   is 5 or less

Total_Practices (E23)

12. Takara wants to document the answer Solver found, including the constraints and a list of the values Solver changed to solve the problem. Produce an Answer report for the Solver model as follows:

a. Solve the model again, this time choosing to produce an Answer report.

b. Use Games Answer Report as the name of the worksheet containing the Answer report.

Your workbook should look like the Final Figures on the following pages. Save your changes, close the workbook, and then 

Exp19_Access_Ch02_ML2 – Prestige Hotel 1.0

 Exp19_Access_Ch02_ML2 – Prestige Hotel 1.0

  

Project Description:

The Prestige Hotel chain caters to upscale business travelers and provides state-of-the-art conference, meeting, and reception facilities. It prides itself on its international, four-star cuisine. Last year, it began a member reward club to help the marketing department track the purchasing patterns of its most loyal customers. All of the hotel transactions are stored in a database. Your task is to help the managers of the Prestige Hotels in Denver and Chicago identify their customers who stayed in a room last year and who had two persons in their party.

     

Start Access. Open the downloaded   Access file named Exp19_Access_Ch02_ML2_Hotel. Grader has automatically added   your last name to the beginning of the filename. Save the file to the   location where you are storing your files.

 

Import   the location data from the Excel file Location.xlsx   as a new table in the current database. Using the wizard, specify that the   first row contains column headings, set the LocationID field to be indexed   with no duplicates, and set the LocationID field as the primary key. Import   the table with the default name Location   and do not save the import steps.

 

View   the Location table in Design view and change the field size for the   LocationID field to Long Integer.   Save the table. Click Yes in the   dialog box indicating that some data may be lost. Close the table.

 

Add   the Location, Orders, Members, and Service tables to the Relationships window to begin establishing   relationships in the database. Close the Show Table dialog box. Create a   one-to-many relationship between the Location table and the Orders table   using the LocationID field. Enforce Referential Integrity. Select the option   to cascade update the related fields.

 

Create   a relationship between the Members and Orders tables using the MemNumber   field, ensuring that you enforce referential integrity and cascade update   related fields.

 

Create   a relationship between the Service and Orders tables using the ServiceID   field, ensuring that you enforce referential integrity and cascade update   related fields. Save and close the Relationships window.

 

Create   a new query in Design view using Location,   Members, Orders, and Service tables.   Add the following fields to the query (in this order): ServiceDate from the Orders table; City from the Location table, NoInParty from Orders table; ServiceName   from the Service table; and FirstName   and LastName from the Members   table. Set the criteria in city field to limit the output to Denver.

 

Display   only service dates from 7/1/2017   to 6/30/2018 (Hint: Use the Between command).

 

Set   the NoInParty criterion to 2.   Sort the results in ascending order by the ServiceDate. Run and save the   query with the name Denver Rooms 2 Guests.

 

Use   Design view to change the order of the query fields so that they display as   FirstName, LastName, ServiceDate, City, NoInParty, and ServiceName. Run, save   the changes to the query, and close the query.

 

Copy   the Denver Rooms 2 Guests query   and paste it in the Navigation pane, renaming the new query Chicago Rooms 2 Guests.

 

Open   the Chicago Rooms 2 Guests query   in Design view, and change the City criterion from Denver to Chicago.   Run the query and save the changes. Close the query.

 

Close   the database and exit Access. Submit the database as directed.