Giter Club home page Giter Club logo

java2javascript-lab-1's Introduction

Instructions

Use the provided html/css/js files and folders to implement the following methods.

2: Loops

2.1 1 to 10

Write a method that prints the numbers 1 to 10

2.1.1 Example

1: oneToTen()
2: ***Output***
3: 1
4: 2
5: 3
6: 4
7: 5
8: 6
9: 7
10: 8
11: 9
12: 10

2.2 Odd Numbers

Write a method that prints the positive odd numbers less than 20

2.2.1 Example

1: oddNumbers()
2: ***Output***
3: 1
4: 3
5: 5
6: 7
7: 9
8: 11
9: 13
10: 15
11: 17
12: 19

2.3 Square Numbers

Write a method that prints the square numbers up to 100

2.3.1 Example

1: squares()
2: ***Output***
3: 1
4: 4
5: 9
6: 16
7: 25
8: 36
9: 49
10: 64
11: 81
12: 100

2.4 Random Numbers

Write a for loop to print out four random integers between 1 and 100

2.4.1 Example

1: random4()
2: ***Output***
3: 3
4: 5
5: 2
6: 8

2.5 Even Numbers < n

Write a method to print out the positive even numbers less than n

2.5.1 Example

1: even(20)
2: ***Output***
3: 2
4: 4
5: 6
6: 8
7: 10
8: 12
9: 14
10: 16 11: 18

2.6 Powers of 2

Write a method to print out the powers of 2 from 21 up to 2n ###2.6.1 Example 1: powers(8)
2: ***Output***
3: 2
4: 4
5: 8
6: 16
7: 32
8: 64
9: 128
10: 256

2.7 Are we there yet?

Write a program that outputs "Are we there yet?" and then waits for input. If the input is "Yes" the program outputs "Good!" and exits, otherwise the program loops.

2.7.1 Example

1: "Arewethereyet?"
2: No
3: "Arewethereyet?"
4: Spoons
5: "Arewethereyet?"
6: Yes
7: Good!

2.8 Triangle

Write a method that uses nested loops to produce the following pattern 1: triangle()
2: ***Output***
3: *
4: **
5: ***
6: ****
7: *****

2.9 Table Square

Write a method that prints out a 4x4 table square

2.9.1 Example

1: tableSquare()
2: ***Output***
3: A4x4tablesquare
4: |1|2| 3| 4|
5: |2|4| 6| 8|
6: |3|6| 9|12|
7: |4|8|12|16|

2.10 Table Squares

Extend your answer to the last question produce a method that will print out a n x n table square

2.10.1 Example

1: tableSquares(6)
2: ***Output***
3: A6x6tablesquare
4: |  1 |   2 |   3 |   4 |   5 |   6 |
5: |  2 |   4 |   6 |   8 | 10 | 12 |
6: |  3 |   6 |   9 | 12 | 15 | 18 |
7: |  4 |   8 | 12 | 16 | 20 | 24 |
8: |  5 | 10 | 15 | 20 | 25 | 30 |
9: |  6 | 12 | 18 | 24 | 30 | 36 |

java2javascript-lab-1's People

Contributors

froilan-miranda avatar

Watchers

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