Giter Club home page Giter Club logo

codingexerciseswk2's Introduction

CodingExercisesWk2

a group coding exercise

Do this in either Java or Python. Your choice.

Code Exercises

  • 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

Class Use

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 this document.

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."

codingexerciseswk2's People

Contributors

xt0fer avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.