Giter Club home page Giter Club logo

simple-java-functions's Introduction

simple-java-functions

Homework 2

We're going to write a two functions to calculate the equivalent human age of cats and dogs.

Note that these are rough estimations based generally accepted observation and opinion, and are interesting food for thought, but not exact science.

GitHub Info

Repository: https://github.com/htc-ccis2595/simple-java-functions

You need to fork this repository and submit a pull request to turn in the assignment. Please post a screenshot of the pull request to the D2L dropbox. The dropbox is mainly used to communicate due dates, not for storing the completed work. You do not need to upload the project to D2L, only to GitHub.

Assignment

Use InteliJ to create a new project called simple-java-functions in the spot where you clone the GitHub Repository.

Use the Command Line template to make a basic "Main" class with a main function. Create two additional functions as indicated below. These functions must be static functions, just like main. Inside the main function you will use these functions to calculate some pet human ages.

Dog Human Age

Make a static function called "calculateDogHumanAge" that:

  • takes a single input parameter (that might be a decimal)
  • returns the human age

For the first two years, a dog year is equal to 10.5 human years. After that, each dog year equals 4 human years.

FYI: This calculation is based on studies that indicate dogs, except maybe larger breeds, develop more quickly in the first two years of life.

Cat Human Age

Make a static function called "calculateCatHumanAge" that:

  • takes a single input parameter (that might be a decimal)
  • returns the human age

A one year old, a cat is roughly equal to a 15 year old human. At two years, a cat is roughly equal to a 25 year old human. After that, each cat year equals about 4 human years. So a 3 year old cat is 29, and a 4 year old cat is 33.

Main method

Use each of the above functions in your main method. Call them 3-4 times with different values and print friendly messages to the output that show both the pet age and their human age. Make sure to check your calculation results to show that the functions work.

simple-java-functions's People

Contributors

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