13 Lesson 14 - Activity 1
13
Lesson 14 - Activity 1
/*
* Term 1: Lesson 14 Coding Activity 1
* Test if an integer is not between 5 and 76 inclusive.
*
*
Sample Run 1
*
Enter a number:
*
7
*
False
*
*
*
Sample Run 2
*
Enter a number:
*
1
*
True
*
*/
import java.util.Scanner;
class Lesson_14_Activity_One {
public static void main(String[] args) {
//Declare a scanner and input an int. Scanner scan = new Scanner(System.in); System.out.println("Please enter an integer:"); int n = scan.nextInt();
//If n is not in the range, print True. if ( !( n >= 5 && n = 0 && y >= 0)
System.out.println("Both are positive or zero."); else
System.out.println("One or both are negative."); } }
APCS Unit 2 Activity Guide Version 1.0
? Edhesive
15
Lesson 14 - Activity 3
/*
* Term 1: Lesson 14 Coding Activity 3
* The Internet runs on web addresses.The addresses we type represent the IP
* address
* for each site and how the computer finds an individual web page.
*
* IP addresses are made up of four numbers, each between 0 and 255 separated
* by a period.
* For example, 128.253.21.58 is an IP address.
*
* Write a program to enter four numbers and test if they make up a valid IP
* address.
* In other words, test to see if the numbers entered are between 0 and 255
* inclusive.
*
*
Sample Run 1
*
Please enter the first octet:
*
898
*
Please enter the second octet:
*
34
*
Please enter the third octet:
*
712
*
Please enter the fourth octet:
*
45
*
Octet 1 is incorrect
*
Octet 3 is incorrect
*
*
*
Sample Run 2
*
Please enter the first octet:
*
112
*
Please enter the second octet:
*
200
*
Please enter the third octet:
*
0
*
Please enter the fourth octet:
*
254
*
IP Address: 112.200.0.254
*
*/
import java.util.Scanner;
class Lesson_14_Activity_Three {
public static void main(String[] args) {
//Declare a Scanner and input four octets. Scanner scan = new Scanner(System.in);
APCS Unit 2 Activity Guide Version 1.0
? Edhesive
16
} }
System.out.println("Please enter the first octet: "); int o1 = scan.nextInt();
System.out.println("Please enter the second octet: "); int o2 = scan.nextInt();
System.out.println("Please enter the third octet: "); int o3 = scan.nextInt();
System.out.println("Please enter the fourth octet: "); int o4 = scan.nextInt();
//Set up a flag variable for correct input. int correct = 1;
//Check octet 1. if (!(o1 >= 0 && o1 = 0 && o2 = 0 && o3 = 0 && o4 ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
- table of contents teals
- grade 2 module 7
- lesson 8 9 progress correctionkey d to algebra related
- unit 8 2d arrays github pages
- sentence lesson 1 the write foundation
- sas curriculum answer key
- course syllabus advanced placement computer science a
- edhesive answer key unit 2
- 13 lesson 14 activity 1
- term 1 unit 1 week 1 worksheet output solution
Related searches
- activity 1 3 3 thermodynamics answer key
- activity 1.3.3 thermodynamics answer key
- 13 reasons why season 1 online free
- 13 reasons why episode 1 watch online
- 13 reasons why season 1 episodes
- 13 reasons why season 1 episode 13
- 13 reasons why season 1 cast
- 13 reasons why season 1 download
- 13 reasons why season 1 summary
- 13 reasons why season 1 recap
- lesson plan activity for preschool
- 13 reasons why season 1 episodes summary