use incremental development to write a function called hypotenuse that returns the length of the hypotenuse of a right triangle given the lengths of the other two legs as arguments. Record each stage of the development process as you go. After the Õnal stage of development, print the output of hypotenuse(3, 4) and two other calls to hypotenuse with diàerent arguments. Include all of the following: An explanation of each stage of development, including code and any test input and output. The output of hypotenuse(3,4). The output of two additional calls to hypotenuse with diàerent arguments
A mother has children of varying ages in need of t-shirts. The mother has to distribute t-shirts with the following requirements:
Each child should get at least one t-shirt. A child with an age higher than adjacent children should get more t-shirts than them. How should the mother distribute such that total number of t-shirts is minimized?
3.Create a class node that contains a random value -50<x<50, Create a 2-d array (size m, n entered by the user ) of these random nodes find the internal square with the largest sum of values within it. For example if the user enters m = 4, and n=3 and values are generated it might look like this
-324-168 -2 5-2211 5-10312 335-17-33
You might think the maximum sub-matrix would be -25 5-20 335 sum =26
But it is actually 8 11 12 sum =31 you need to check all possible rectangles, this is a 2d version of the greatest common substring problem.
2.Create a class box, each box has an int ID, and an east and west side, these are represented as Booleans, all of these are randomly assigned true or false. If true you can pass through that side. These are ONE WAY doors. If false it is a wall. Create a ROW of 8 random boxes. Determine which box has the maximum reachability. Use : to represent a door and a | to represent a wall in your display, example follows:
|0| :1|:2:|3:|4||5::6: |7: Box 0 you can go no where Box 1 you can visit 0 ((box 1 has a West door)) Box 2 you can visit 1 and 0 AND 3 and 4 Box 3 you can visit 4 Box 4 you can go no where Box 5 you can visit 6 and 7 Box 6 you can visit 5 and 7 Box 7 you can go no where The box with maximum reachability is box 2 where you can reach 0,1,3,4
1.Generate N>10 random values from 1 to 100 using a uniform probability distribution. N is entered by the user. The first 5 values are put into nodes and added to a priority queue based on their value. Each node also contains a list of values. After the first 5 are inserted into the priority queue the rest of the values are added to the lists with the initial node being the delimiter as the maximum value. This defines an interval from the previous node to that value. The range for the first value is 1 to is value Display the contents of the Priority Queue as below:
For example if the values were 5, 55, 22, 14, 98, 23, 99, 40, 7, 55, 25, 9, 66
The PQueue would have interval nodes 5, 14, 22, 55, 98 the entire contents would be
Node 5 has NO entries Node 14 has values 7, 9 (( values greater than 5 but <= 14)) Node 22 has NO values Node 55 has value 23, 55 Node 98 has value 66
The value 99 does not appear since it does fall within any of the intervals
Write a program to convert temperature in Fahrenheit to temperature in Celsius and vice versa according to the user’s preference. The formula for the conversion in one direction is as follows: Tc = (5/9) * (Tf – 32) Check the correctness and allowed scope of the entered data. Let the user enter data from a file and write the conversion next to the initial value. For example, if the user needs to convert F to C, create a file named FtoC.txt with random Fahrenheit values. Read the file from your program and write next to each F value the C conversion. Do this for CtoF as well.