This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Program that makes several mathematical operations | |
*/ | |
public class Calculator2 { | |
public static void main(String[] args) { | |
int op1 = 30; | |
int op2 = 3; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
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; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Program description | |
*/ | |
public class PrintName { | |
public static void main(String[] args) { | |
//Message | |
String name = "Pedro"; | |
String surname = "Almeida"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Program description | |
*/ | |
public class CalculatorMethod { | |
public static void main(String[] args) { | |
int operator1 = 1; | |
int operator2 = 2; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Program description | |
*/ | |
public class Sequence { | |
public static void main(String[] args) { | |
int beginning = 1; | |
int sequence; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Program description | |
*/ | |
public class SequenceTwo { | |
public static void main(String[] args) { | |
int beginning = 1; | |
int sequence; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Program description | |
*/ | |
public class Grades { | |
public static void main(String[] args) { | |
double grade = 7.5; | |
if(grade<0){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Program description | |
*/ | |
public class SequenceWithInt { | |
public static void main(String[] args) { | |
int sequence = 5; | |
for(int i = 1 ; i <= 10 ; i++){ |
OlderNewer