Conditional statements. Java Core презентация

Содержание


Презентации» Информатика» Conditional statements. Java Core
Conditional statements 
 Java CoreAgenda
 Operators
 Conditional statements
 Enum
 Comparing objects
 JUnit
 Practical tasksArithmetic operators
 Simple Assignment Operator
 =  Simple assignment operatorUnary OperatorsEquality and Relational Operators
 Equality and Relational Operators
 ==	Equal to
 !=	NotConditional Operators
 The && and || operators perform Conditional-AND and Conditional-ORTernary Operator ? :Statement ifswitch
  switch (expression) 
  { 
   ExampleEnumExample
 Season season;
 ...
 switch (month) {
 case "Desember": case "January":Comparing objects 
 public class Student {
 	private String name;
 	privatehashCodeequalsJUnit Framework
 JUnit is a unit testing framework for the JavaTesting Problems
 Programmers should write tests
 As you probably know programmersJUnit plugin for Eclipse IDE
 Mr. Erich Gamma who is aJUnit assertion methodsClass Calc
 public class Calc {
   
  Class CalcTest
 import static org.junit.Assert.*;
 import org.junit.Test;
 public class CalcTest {
Practical tasks
 Enter three numbers. Find out how many of themHomeWork (online course)
 UDEMY course "Java Tutorial for Complete Beginners": https://www.udemy.com/java-tutorial/
Unit Testing with JUnit
 Short step-by-step online course:  https://www.udemy.com/junit-tutorial-for-beginners-with-java-examples/learn/v4/overviewHomework
 Solve the next tasks:
 read 3 float numbers and check:The end



Слайды и текст этой презентации
Слайд 1
Описание слайда:
Conditional statements Java Core


Слайд 2
Описание слайда:
Agenda Operators Conditional statements Enum Comparing objects JUnit Practical tasks

Слайд 3
Описание слайда:
Arithmetic operators Simple Assignment Operator = Simple assignment operator

Слайд 4
Описание слайда:
Unary Operators

Слайд 5
Описание слайда:
Equality and Relational Operators Equality and Relational Operators == Equal to != Not equal to > Greater than >= Greater than or equal to < Less than <= Less than or equal to

Слайд 6
Описание слайда:
Conditional Operators The && and || operators perform Conditional-AND and Conditional-OR operations on two boolean expressions. && Conditional-AND || Conditional-OR

Слайд 7
Описание слайда:
Ternary Operator ? :

Слайд 8
Описание слайда:
Statement if

Слайд 9
Описание слайда:
switch switch (expression) { case const-expr1 : statement(s); break; case const-expr1 : statement(s); break; default : statement(s); break; }

Слайд 10
Описание слайда:
Example

Слайд 11
Описание слайда:
Enum

Слайд 12
Описание слайда:
Example Season season; ... switch (month) { case "Desember": case "January": case "February": season = Season.WINTER; break; case "Marth": case "April": case "May": season = Season.SPRING; break; case "June": case "Jule": case "August": season = Season.SUMMER; break; case "September": case "October": case "November": season = Season.AUTUMN; break; default: System.out.println("No this month"); System.exit(0); }

Слайд 13
Описание слайда:
Comparing objects public class Student { private String name; private int age; public Student(String name, int age) { this.name = name; this.age = age; } getters, setters ... }

Слайд 14
Описание слайда:
hashCode

Слайд 15
Описание слайда:
equals

Слайд 16
Описание слайда:
JUnit Framework JUnit is a unit testing framework for the Java programming language. JUnit has been important in the development of test-driven development, and is one of a family of unit testing frameworks collectively known as xUnit that originated with SUnit.

Слайд 17
Описание слайда:
Testing Problems Programmers should write tests As you probably know programmers always busy, and they have no time to write tests They need some tool that can help them Main requirements for this tool: A few lines of code then test should run To write test that won’t run, then write the code that will make run

Слайд 18
Описание слайда:
JUnit plugin for Eclipse IDE Mr. Erich Gamma who is a one of developers of JUnit framework also known as a Eclipse IDE developer JUnit well integrated into Eclipse IDE

Слайд 19
Описание слайда:
JUnit assertion methods

Слайд 20
Описание слайда:

Слайд 21
Описание слайда:

Слайд 22
Описание слайда:
Class Calc public class Calc { public int add(int a, int b) { return a + b; } public int div(int a, int b){ return a / b; } }

Слайд 23
Описание слайда:
Class CalcTest import static org.junit.Assert.*; import org.junit.Test; public class CalcTest { Calc calc = new Calc(); @Test public void testAdd() { assertTrue(calc.add(1, 5) == 6);} @Test public void testDivPositive() { int actual = 4; int expected = calc.div(9, 2); assertEquals(actual, expected); } @Test(expected = Exception.class) public void testDivZero() { int actual = calc.div(23, 0); } }

Слайд 24
Описание слайда:
Practical tasks Enter three numbers. Find out how many of them are odd. Enter the number of the day of the week. Display the name in three languages. Enter the name of the country. Print the name of the continent. (Declare enum with names of continents) Create class Product with fields name, price and quantity. Create four instances of type Product. Display the name and quantity of the most expensive item. Display the name of the items, which has the biggest quantity.

Слайд 25
Описание слайда:
HomeWork (online course) UDEMY course "Java Tutorial for Complete Beginners": https://www.udemy.com/java-tutorial/ Complete lessons 10, 11, 13:

Слайд 26
Описание слайда:
Unit Testing with JUnit Short step-by-step online course: https://www.udemy.com/junit-tutorial-for-beginners-with-java-examples/learn/v4/overview

Слайд 27
Описание слайда:
Homework Solve the next tasks: read 3 float numbers and check: are they all belong to the range [-5,5]; read 3 integer numbers and write max and min of them; read number of HTTP Error (400, 401,402, ...) and write the name of this error (Declare enum HTTPError) Сreate class Dog with fields name, breed, age. Declare enum for field breed. Create 3 instances of type Dog. Check if there is no two dogs with the same name. Display the name and the kind of the oldest dog. *Add Unit Tests to each task, publish code on GitHub

Слайд 28
Описание слайда:
The end


Скачать презентацию на тему Conditional statements. Java Core можно ниже:

Похожие презентации