Skip to content

Instantly share code, notes, and snippets.

@PocasPedro
PocasPedro / SpeedOfLight.java
Created September 25, 2017 17:15
Java Fundaments for Kids - Exercise 1
/**
Simple Program that prints the Speed of Light in meters per second. Coded by Pedro.
*/
public class SpeedOfLight {
public static void main(String[] args) {
//I have used an integer because the needed value fits the range of an integer. I have not used a DataType wrapper here to keep it simple.
int sol = 299792458;
// Prints "The light speed is ... m/s" to the terminal window.
@PocasPedro
PocasPedro / Calculator2.java
Created October 2, 2017 13:55
Java Fundaments for Kids - Exercise 2
/**
Program that makes several mathematical operations
*/
public class Calculator2 {
public static void main(String[] args) {
int op1 = 30;
int op2 = 3;
@PocasPedro
PocasPedro / CarSpeed.java
Created October 2, 2017 13:58
Java Fundaments for Kids - Exercise 3
/**
Program that calculates the Average Speed of a Car
I made the program to calculate only the speed that was asked for the exercise. Could have made it to ask the user to introduce its own values but I think thats more complex
than what was aked
*/
public class CarSpeed {
public static void main(String[] args) {
int distance = 100; //distance in meters
@PocasPedro
PocasPedro / Calculator3.java
Created October 2, 2017 13:59
Java Fundamentals for Kids - Exercise 4
/**
Program that divides 22/3 and displays the format in different data types
*/
public class Calculator3 {
public static void main(String[] args) {
int op1 = 22;
int op2 = 3;
@PocasPedro
PocasPedro / PrintName.java
Created October 2, 2017 16:55
Java Fundaments for Kids - Exercise 5
/**
Program description
*/
public class PrintName {
public static void main(String[] args) {
//Message
String name = "Pedro";
String surname = "Almeida";
@PocasPedro
PocasPedro / CalculatorMethod.java
Created October 2, 2017 17:11
Java Fundaments for Kids - Exercise 6
/**
Program description
*/
public class CalculatorMethod {
public static void main(String[] args) {
int operator1 = 1;
int operator2 = 2;
@PocasPedro
PocasPedro / Sequence.java
Created October 2, 2017 17:30
Java Fundaments for Kids - Exercise 7
/**
Program description
*/
public class Sequence {
public static void main(String[] args) {
int beginning = 1;
int sequence;
@PocasPedro
PocasPedro / SequenceTwo.java
Created October 16, 2017 16:35
Java Fundamentals for Kids - Exercise 8
/**
Program description
*/
public class SequenceTwo {
public static void main(String[] args) {
int beginning = 1;
int sequence;
@PocasPedro
PocasPedro / Grades.java
Created October 16, 2017 17:04
Java Fundamentals for Kids - Exercise 9
/**
Program description
*/
public class Grades {
public static void main(String[] args) {
double grade = 7.5;
if(grade<0){
@PocasPedro
PocasPedro / SequenceWithInt.java
Created October 16, 2017 17:23
Java Fundamentals for Kids - Exercise 10
/**
Program description
*/
public class SequenceWithInt {
public static void main(String[] args) {
int sequence = 5;
for(int i = 1 ; i <= 10 ; i++){