GithubHelp home page GithubHelp logo

stage0-module3-task2's Introduction

Tasks:

1) Java variable names.

Make the program work (var starts with 1, $, % etc). Update given code so as to be able to compile it:

public class JavaVariableNames {
    public static void main(String[] args) {
        int 2morrow = 0;
        int $money = 10;
        int %hundred = 100;
        int !back = 1000;
        int _underscore = 10000;
        int #sharp = 100000;
        int *star = 1000000;
        int BADEXAMPLEOFVARNAME = 1000000;
    }
}

2) Copied names.

Make the program work (vars have the same names). Update given code so as to be able to compile it:

public class CopiedNames {
    public static void main(String[] args) {
        int variable = 0;
        int variable = 2000;
        int value = 1000;
        int variable = 4000;
        int value2 = 3000;
        int variables = 5000;
        variables = 7000;
        int value = 90000;
        int int = 100000;
        int my integer = 1000000;
        int my+var = 1234567;
        int my__-__integer = 1234567;
    }
}

3) Naming conventions.

Update given code so that it is corresponding to java name conventions, notice the constants with the keyword final, following the case of variables (if the variable in example is in snake case this pattern should be followed):

public class NamingConvention {
    public static void main(String[] args) {
         int _variable = 10;
         int variable_One = 1;
         int variableTwo = 2;
         int variable_three = 3;
         final int VARIABLEFOUR = 4;
         final int VARIABLEfIVE = 5;
         int VariableSix = 6;
         int variableseven = 7;
         int VariableEight = 8;
    }
}

4) Advanced naming convention.

(After advanced reading about java naming conventions ) In the given code snippet make the program correspond to java code conventions (method, class, field names...):

public class advancedNamingConvention {
    private static final int adult_age = 18;

    private int AGE;
    private int phoneNumber;

    void CAllToFriend() {
        //some code
    }

    void callByNumber(int Number) {
        //some code
    }
}

stage0-module3-task2's People

Contributors

art-orient avatar sukora-stas avatar andrekukshinov 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.