Matching Special Characters | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

## Problem DescriptionIn this problem you must scan a line of characters and determine if each of three special characters occur in pairs. The special characters are parenthesis, brackets, and braces. These are ( ), [ ], and { }. The order is not important. Any other characters should be ignored. ## Detailed Requirements- Read a line of characters. This line will not exceed 80 characters. You must allow the user to enter all the characters at one time. You cannot require the user to hit enter after each character.
- Determine if there is one left parenthesis for each right parenthesis.
- Determine if there is one left bracket for each right bracket.
- Determine if there is one left brace for each right brace.
- Ignore any other character.
- Display "All special characters have a match" if each special character has a match. Display "Not all special characters have a match" if any special character does not have a match.
- Add comments at the top of your source code for your name and the problem number.
- The judges will enter additional test data not provided below to further test your application. You don't need to validate the input. The judges will only enter valid data.
## OutputDisplay a single line indicating whether all special characters have a match for each test case. Format the output exactly as shown in the test data below. ## Test Data
A sample console interface is provided below. Your user interface is not being judged. Each set of data can be tested by rerunning the application. Enter characters: Figure 1 A sample graphical user interface is provided below. Your user interface is not being judged. Each set of data can be tested by rerunning the application. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Moving Averages | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

## Problem DescriptionA moving average is often used to “smooth” a series of numbers to see if a trend exists. For example you could plot a series of stock prices taken daily for a year and see if there is a trend. Alternatively you could plot the moving average of those same stock prices. The moving averages should give a truer representation of the actual trend. Create an application that will display the moving averages of a series of numbers. There will be n numbers in this series. The subset of numbers to average will be fixed at some value called s. When n = 10 and s = 4 we would want to calculate a moving average of 10 numbers 4 at a time. Assume the numbers are 1, 2, 3, 4, 5, 6, 7, 8, 9, and 10. ## Detailed Requirements- Read a value for the number of items in the series. This will be a positive integer greater than 1 and less than 101.
- Read a value for the subset size. This will be a positive integer. It will be less than the number of items in the series.
- Read each number in the series. The numbers can be any floating point value – positive, negative, or zero. You must allow all the numbers to be entered at once. In other words, you cannot require the user to press enter after each number is entered. Separate each number by a space.
- Calculate and display the moving averages. Separate each number by a space.
- Add comments at the top of your source code for your name and the problem number.
- The judges will enter additional test data not provided below to further test your application. You don't need to validate the input. The judges will only enter valid data.
## OutputDisplay a single line containing the moving averages as shown in the Output column of the Test Data section below. ## Test Data
A sample console interface is provided below. Your user interface is not being judged. Each set of data can be tested by rerunning the application. Enter number in series: Figure 1 A sample graphical user interface is provided below. Your user interface is not being judged. Each set of data can be tested by rerunning the application. Figure 2 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Meal Deal | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

## Problem DescriptionA group of self-employed business associates often travel together and don’t want to be bothered splitting their food bills at every meal. During the trip they take turns paying the daily food bills. For example John may pay all the bills on Monday, Jane all the bills on Tuesday, and so on. When they return they have to determine who owes money so they all end up spending the same amount for food. You have been asked to automate this process. ## Detailed Requirements- Prompt for and read the number of travelers on a trip. This will be a positive integer greater than one ( > 1 ) and less than 100. (Sometimes a lot of people travel together!)
- Read the amount each person paid for food. This will be a floating point number greater than zero. It will have no upper limit except the maximum value that can be stored. Enter all the amounts on a single line separated by one space.
- Display the minimum amount of money that must change hands so that every traveler ends up paying the same amount. For example, assume four workers travel and have daily food bills of $10, $20, $30, and $40. This means traveler 1 must repay $15 and traveler 2 must repay $5 for a total that must be repaid of $20. We don’t care who the money goes to or who the money comes from; only the total amount that must be collected which is $20.
- Display the output rounded to two decimal positions.
- Add comments at the top of your source code for your name and the problem number.
- The judges will enter additional test data not provided below to further test your application. You don't need to validate the input. The judges will only enter valid data.
## OutputDisplay a single numeric value representing the minimum amount that must change hands so that every traveler paid the same amount. The number of decimals in the output doesn’t need to be rounded. ## Test Data
A sample console interface is provided below. Your user interface is not being judged. Each set of data can be tested by rerunning the application. Enter the number of travelers: Figure 1 A sample graphical user interface is provided below. Your user interface is not being judged. Each set of data can be tested by rerunning the application. Figure 2 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Palindrome | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

## Problem DescriptionA palindrome is a word that is the same forward as backward: “mom” and “bib” are examples. Positive integers can be palindromic. For example the numbers 3, 484, 12621, and 458854 are all palindromic. How many palindromic integers are there between x and y inclusive given that x will be > 0 and y will be <= 1,000,000? ## Detailed Requirements- You will enter an x value and a y value within the above constraints. The x value will be less that the y value. Each will be an integer. You do not need to edit these numbers.
- The application must calculate and display the number of palindromes within that range.
- Include x and y as potential palindromes. For example, if x = 343 and y = 6226 then the number of palindromes is at least two because x and y are both palindromes.
- Add comments at the top of your source code for your name and the problem number.
## OutputDisplay a single number indicating how many palindromes exist in the range for each test case. Format the output exactly as shown in the test data below. ## Test Data
Lower bound: Figure 1 Figure 2 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Stacking Blocks | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

## Problem DescriptionIn this problem you will be given X number of blocks. You must programmatically determine the highest level to which the blocks can be stacked and how many blocks, if any, are left over. For example, with 3 blocks I can build a pyramid of 2 rows (2 levels) and have 0 left over as shown below. With 8 blocks I can build a pyramid of 3 rows (3 levels) and have 2 left over. ## Detailed Requirements- Read the number of blocks. This will be an integer value greater than zero ( > 0 ) and less than largest size an integer can be.
- Determine the highest level to which the blocks can be stacked and how many blocks are left over.
- Display the level and the number of blocks left over.
- Add comments at the top of your source code for your name and the problem number.
## OutputFor each test case display a single line indicating the highest level possible and the number of blocks left over. Format the output exactly as shown in the test data below. ## Test Data
Your user interface is not being judged. Each set of data can be tested by rerunning the application. Number of blocks: Figure 3 Figure 4 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

Gather Points | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

## Problem DescriptionThe goal of this exercise is to navigate through an array accumulating “points”. You can only move forward (to the right or down). Diagonal moves are not allowed. You enter the array at the top left corner and exit at the bottom right corner. You must always move to the next square with the largest value. The array will be of various sizes and the values will be given to you. You will not encounter a choice between two numbers that are equal. One choice will always be greater than the other. The path accumulating the most points is highlighted below. The total points accumulated are 37. This is based on the following: - Add 5 from starting point. Then “move” right or down to the larger of 6 or 8.
- Accumulate 8 by “moving” to that square.
- Then “move” to the larger of 2 or 10.
- Accumulate 10 by “moving” to that square.
- Continue the process arriving at a total of 37.
If we repeat the same process on another sample array below we arrive at a total number of 51 accumulated points. The points accumulated were calculated based on the following “path” through the array: 3 + 7 + 10 + 8 + 9 + 5 + 9 = 51. ## Detailed Requirements- Only integers will exist in the array. The array will not necessarily have the same number of rows and columns but it will always be rectangular. You may hard code the array - no user input is required.
- The array will never have a combination where the choice where to move will be between two equal numbers. One move will always have more points than an alternative move.
- Add comments at the top of your source code for your name and the problem number.
- The judges will use additional test data not provided below to further test your application.
## OutputDisplay a single number that is the maximum sum of the digits representing a path from the upper left corner to the lower right corner. ## Test Data |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

You Are It | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

## Problem DescriptionKids at a birthday party want to play a favorite game modeled after the game of tag. Unfortunately it is raining so they can’t go outside. They can’t run in the house so you decide to write a computer application to simulate the game. In the game the children sit in a circle and one person outside the ring (the leader) sings a song with a fixed number of words. Moving clockwise around the circle, the leader points to a new child in the ring for each word in the song. The child being pointed to on the last word of the song is out and must leave the circle. The leader then repeats the process with the smaller circle. The game continues until the last child is eliminated. This child is then the leader to start the next game. ## Detailed Requirements- Read an integer value representing the number of kids who will be playing the game. The number will be greater than one and less than 1001.
- Read an integer value representing the number of words in the song. The number will be greater than one and less than the maximum size an integer can store.
- Display the list, in order, of the players eliminated.
- Add comments at the top of your source code for your name and the problem number.
## OutputDisplay a single line indicating the order of players eliminated. Separate each number by a single space. ## Test Data
Enter number of kids: Figure 1 Figure 2 |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

The Snail in the Well | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||

## Problem DescriptionA snail is at the bottom of a well and wants to climb to the top. The snail can climb X feet while the sun is up, but slides down Y feet at night while sleeping. The snail has a fatigue factor of F%, which means that on each successive day the snail climbs F% feet less than it did the previous day. The distance lost to fatigue is always F% of the first day's climbing distance. Given the height of the well, X, Y, and F, on what day does the snail leave the well? An alternative fate is the snail will not be able to climb out of the well and slides back to the bottom. In that case you will need to determine the day when the snail returns to the bottom of the well. Consider the example below. Height of well = 6; X (distance climbed the first day) = 3; Y (distance slipped each night) = 1; F (fatigue percent) = 10
Example 1 The snail’s height on the third day (6.1 feet) exceeds the height of the well (6 feet) and this indicates it has climbed out of the well. Another example demonstrates the snail failing back to the bottom. Height of well = 1; X (distance climbed the first day) = 1; Y (distance slipped each night) = 1; F (fatigue percent) = 1.
Example 2 The snail’s height on the second day (-0.01 feet) is negative and this indicates it has slid back to the bottom of the well. - A day consists of a period of sunlight followed by a period of darkness.
- The snail escapes the well when its height exceeds the height of the well.
- The snail hits the bottom of the well again when its height becomes negative (< 0).
- Input will consist of four integer numbers separated by a single space. Each number will be greater than 0 and less than 101. The first number will be the height of the well. The second number will be how far the snail climbs on the first day. (The snail will never climb a negative distance.) The third number will be how far the snail slips each night. The fourth number will be “fatigue factor”.
- All the numbers input will be considered to be in feet.
- The fatigue factor is used to determine how much the snail’s climbing ability is reduced. The reduction amount is the same for each day and is based on the climbing distance of the first day. In the example 1 above, the fatigue factor is 10. This means the snail will climb .3 feet less each day. This is calculated as the first day climbing distance (3 feet) times 10 percent.
- If the fatigue factor drops the snail's climbing distance below zero, the snail does not climb at all that day.
- The snail always slides the same amount at night regardless of how far it has climbed during the day.
- The snail never climbs a negative distance. If the fatigue factor drops the snail's climbing distance below zero, the snail does not climb at all that day.
- The snail leaves the well when the height it has climbed exceeds the height of the well. Your solution should print “Success on day X” where X represents the numerical count of the days.
- The snail hits the bottom of the well again when its height becomes negative (< 0). Your solution should print “Failure on day X” where X represents the numerical count of the days.
- Add comments at the top of your source code for your name and the problem number.
## OutputFor each test case display a single line indicating whether the snail succeeded (left the well) or failed (slid back to the bottom) and on what day. Format the output exactly as shown in the test data below. ## Test Data
A sample console interface and a graphical user interface are provided below. Your user interface is not being judged. Each set of data can be tested by rerunning the application. Figure 1 Figure 2 |

William Gaught

Program Manager

Phone: 407.708.2447

Fax: 407.708.2322

Office: V102-D