T1L1 Coding activity 1
Write a program to print your name to the center of the output screen
import java.util.Scanner;
import java.lang.Math;
class Lesson_1_Activity_One { public static void main(String[] args) {
System.out.println(" Hello");
System.out.println(" Carlos");
}
}
T1L1 Coding activity 2
Write a program to print your name to the center of the output screen on three different
lines
import java.util.Scanner;
import java.lang.Math;
class Lesson_1_Activity_Two { public static void main(String[] args) {
System.out.println(" Car ");
System.out.println(" Los");
System.out.println(" Jurado");
}
}
T1L1 Coding activity 3
Write a program to output the following:
********
*java*
********
import java.util.Scanner;
import java.lang.Math;
class Lesson_1_Activity_Three {
public static void main(String[] args) { System.out.println("********");
System.out.println(" java "); System.out.println("********");
}
}
T1L2 Coding activity 1
Print the following shape:
/\
\/
import java.util.Scanner;
import java.lang.Math;
class Lesson_2_Activity_One { public static void main(String[] args) {
System.out.println ("/\\");
System.out.println ("\\/");
}
}
,T1L2 Coding activity 2
Using only one "System.out.print" command, print the following quote. Make sure to
include the quote marks (") in your output.
"I do not fear computers. I fear the lack of them."
Isaac Asimov
import java.util.Scanner;
import java.lang.Math;
class Lesson_2_Activity_Two { public static void main(String[] args) {
System.out.println ("\"I do not fear computers. I fear the lack of them.\"\nIsaac Asimov");
}
}
T1L2 Coding activity 3
Write the code to output:
-
/\
||
\/
-
class Lesson_2_Activity_Three {
public static void main(String[] args) {
System.out.println (" _");
System.out.println (" / \\");
System.out.println ("| |");
System.out.println (" \\ _ /");
}
}
T1L3 Coding activity 1
Write the code to ask the user to enter their name and print the following message:
Hi ______, nice to see you.
import java.util.Scanner;
import java.lang.Math;
class Lesson_3_Activity_One { public static void main(String[] args) {
Scanner scan= new Scanner (System.in);
String n;
System.out.println ("What is your name?");
n = scan.nextLine();
System.out.println ("Hi " + n + ", nice to see you.");
}
}
T1L3 Coding activity 2
Write a program that asks the user for three names, then prints the names in reverse
order.
Sample Run:
, Please enter three names:
Zoey
Zeb
Zena
Zena
Zeb
Zoey
import java.util.Scanner;
import java.lang.Math;
class Lesson_3_Activity_Two {
public static void main(String[] args) {
Scanner scan= new Scanner (System.in);
String name1;
String name2;
String name3;
System.out.println ("Please enter three names:");
name1 =scan.nextLine();
name2 =scan.nextLine();
name3 =scan.nextLine();
System.out.println (name3+" "+name2+" "+name1);
}
}
T1L3 Coding activity 3
Write a program that will ask the user to enter an adjective and a name. Print the
following sentence, replacing the ______ with the words they entered.
My name is _____. I am _____.
import java.util.Scanner;
import java.lang.Math;
class Lesson_3_Activity_Three {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
String name; String adjective;
System.out.println("Hi there. What is your name?");
name = scan.nextLine();
System.out.println("What adjective describes you?"); adjective = scan.nextLine();
System.out.println("My name is " + name + ". I am " + adjective + ".");
}
}
T1L4 Coding activity 1
Input two doubles and print them backward on the screen.
So if the user enters:
1.3 6.8
It should output:
6.8 1.3
import java.util.Scanner;
import java.lang.Math;