a group coding exercise
Do this in either Java or Python. Your choice.
- For loop from 100 to 5 by 5. print index var.
- For loop from 100 to 5 by 5. do nothing inside the loop.
- Sum Integers from 9 to 17, print sum
- Find and print the smallest integer in an array a = [9, 5, 6, 3, 8, 2, 4];
- Find largest integer in the last array and print it.
- Find and print index of first true element in an array of booleans a = [false, false, false, true, false];
- Find and print index of first true element in an array of booleans (must use a while loop)
- add 5 to every element of an array of integers a = [9, 5, 6, 3, 8, 2, 4]
- divide each element of an array by 1.3; a = [0.5, 1.4, 6.7, 123.4 -34.6]
- raise each element of a double array to it's 3rd power and subtract the original element's value by the value divided by 3.0 a = [1.3, 5.4, 6.1, 1.0, 9.2];
- zero out a 4 by 6 integer array
- multiply each element of a 5 by 5 array of integers by 7
- create a method that takes a 5 by 5 array and produces a 5 by 5 array of booleans. each element in the result should be true if the value in the argument array is even, else it's false.
- create a method that takes two doubles and returns the first parameter raised to the second parameter's value
- create a method that returns a boolean if the Object passed to it is a Fish or not
- There is an object x which has a method (double)Balance(). Build an IF statement that prints "Paid Off" if the result of the balance call is less than of equal to 1.0, else it prints the balance as a Dollar figure (2 decimal places)
- Build a WHILE loop that turns on the heat if the thermo.getTemp() is less than 72.0 else it turns on the A/C if thermo.getTemp() is greater that 76.0.
- Find a number greater than Pi in a double array, print number and its index.
- Given an array of objects (of class Xaction) w/nulls, sum all the values of the objects in the array, using Xaction::getValue(). Print the sum.
- reverse an array of objects of type Xaction
- Print a 5's times table
- detemine the hypotenuse of a 9 by 7 right triangle, assign it to a double
Use groups of 2-4, each group at a whiteboard (or online using a shared google doc), sketching out the answers.
FOR STUDYING for Assessment 1, step thru each of these, typing out a solution into the Solution.java file.
Some of you are asking for an exercise to work with very simple, small, snippets. This repo is good as it lets you work in a group, where you try to generate the code without googling anything. Set up this way, as a group.
Use your Crew members as the group. All gather around a google doc over zoom or discord. allow all crew to access the same document.
Each taking a turn, try to create the code without googling anything. Allow the crew member to get their best effort finished BEFORE anyone says anything. Then, each crew can make comments. The idea is for each of you to do your best in writing out a solution before anyone comments, and giving you the chance to discuss your solution when it's done.
Also, be sure the solution is right! You should, at this point, have within a crew the ability to look at a piece of code and decide whether it is right or not! So everyone should agree, "yes, that's right, that will work."