Giter Club home page Giter Club logo

advanced-functions-lab's Introduction

title type duration creator
Writing Advanced Functions
Lab
1:25
name city
Yuliya Kaleda
NY

Writing Advanced Functions

Note: You can help each other, but everyone must turn in their own code

Exercise

Requirements

You are supposed to write 10 functions that accept parameters. You can use control flow and multiple conditionals. When a function is created, please call it (from inside the main method) and test all the cases including edge cases (e.g. empty strings, null values, extremely big and small values). It is of high importance to practice and master Java fundamentals, which are the core of Android development. Java functions create the solid foundation, without which it is impossible to build high quality bug free apps.

  • Fork this repository & clone your fork to your computer
  • Inside the repo folder create a new IntelliJ project
  • Add code to the IntelliJ project to complete the requirements
  • Commit your changes & push them up to Github
  • Submit a pull request and put your name and "Functions Advanced Lab" in the pull request title

Functions

  1. Write a function that takes in a number and returns true if the number is even or false if the number is odd. You may use control flow and multiple conditionals.

  2. Write a function that takes in two words and compares them. If the spelling is the same, the functions returns true, otherwise false.

  3. Write a function that takes in a word and prints out its every letter on a new line before it sees the letter "w". If it encounters "w" the function should stop executing.

  4. Write a function that generates a random number. Print it out. If the number is greater that 50, return it, otherwise return -1. You may use control flow and multiple conditionals.

  5. Write a function that takes in 3 integers: day, month, and year and computes day, month, and year of the next day. The function should return a string (e.g. day:12 month:11 year:1988)

  6. Write a function that takes in a word, omits every other letter in that word and returns a new word. You can use control flow and multiple conditionals.

  7. Write a function that takes in a number greater than 5 and prints out all the numbers from 1 to that number except number 4. Please use a while statement.

  8. Write a function that takes in 2 numbers, and checks if they are the same. If they are not the same, it adds 1 to every number and returns its sum. If the numbers are the same, it adds 2 to every number and returns its sum.

  9. Write a function that asks the user to enter a country domain. If the user types in "us", the function prints out "United States", if the user enters "de", the function prints out "Germany", if the user types in "hu" the response should be "Hungary". In all other cases the function should print out "Unknown". Please try to use a switch statement and make sure the function works with a user's input of lower and upper case strings.

  10. Write a function that asks the user to type in a letter and prints out whether the letter is a vowel or a consonant. You may use control flow and multiple conditionals.

Deliverable

You are expected to create one Java file with 10 functions and a main method that calls all the other functions, testing all cases. This file should be in an IntelliJ project, and you should submit it via pull request.

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.