Uploaded by Reymar Siobal

TLE-activity-complete

advertisement
/**
*name of program: Hi.java
*Description: This program prints "Hi" on screen
*Made by: Mar T. Ilyo
*/
public class Hi
{
// begin
public static void main(String [] args)
{
System.out.println("Hi");
}
}
---------------------------------------------------------------------------------------/**
*name of program: Hello.java
*Description: This program prints "Hello" on screen
*Made by: Mar T. Ilyo
*/
import javax.swing.JOptionPane;
public class Hello
{
public static void main(String[] args)
{
JOptionPane.showMessageDialog( null, "Hello World" );
}
}
--------------------------------------------------------------------------------------------/**
*name of program: Addition
*Description: The program will print the sum of variables A & B
*Made by: Mar T. Ilyo
*/
public class Addition
{
public static void main (String[] args)
{
double A = 10;
double B = 20;
double C = A + B;
double D = A * B;
double E = A/B;
double F = A-B;
System.out.println("The sum of "+A+" and "+B+" is equal to: "+C);
System.out.println("The product of "+A+" and "+B+" is equal to: "+D);
System.out.println("The quotient of "+A+" and "+B+" is equal to: "+E);
System.out.println("The diffrence of "+A+" and "+B+" is equal to: "+F);
}
}
/**
*name of program: Mdas.java
*Description: This program prints MDAS and Modulo on screen
*Made by: Mar T. Ilyo
*/
public class Mdas
{
public static void main (String[] args)
{
int X, Y, M, D, A, S, Mo;
X = 7;
Y = 4;
M = X * Y;
D = X / Y;
A = X + Y;
S = X - Y;
Mo = X % Y;
System.out.println("The product of "+X+" and "+Y+" is equal to: "+M);
System.out.println("The quotient of "+X+" and "+Y+" is equal to: "+D);
System.out.println("The sum of "+X+" and "+Y+" is equal to: "+A);
System.out.println("The difference of "+X+" and "+Y+" is equal to: "+S);
System.out.println("The modulo of "+X+" and "+Y+" is equal to: "+Mo);
}
}
---------------------------------------------------------------------------------------------------------------------/**
*name of program: Mdas.java
*Description: This program prints MDAS and Modulo on screen
*Made by: Mar T. Ilyo
*/
import javax.swing.JOptionPane;
public class Mdas2
{
public static void main (String[] args)
{
int X, Y, M, D, A, S, Mo;
X = 7;
Y = 4;
M = X * Y;
D = X / Y;
A = X + Y;
S = X - Y;
Mo = X % Y;
JOptionPane.showMessageDialog( null,
"The product of "+X+" and "+Y+" is equal to:"+M+"\n"+
"The quotient of "+X+" and "+Y+" is equal to: "+D+"\n"+
"The sum of "+X+" and "+Y+" is equal to: "+A+"\n"+
"The difference of "+X+" and "+Y+" is equal to: "+S+"\n"+
"The modulo of "+X+" and "+Y+" is equal to: "+Mo);
}
}
import java.util.Scanner;
public class scanX
{
public static void main (String [] arg)
{
Scanner x = new Scanner(System.in);
System.out.print("Enter your name? :");
String name=x.nextLine();
System.out.print("hi "+name+"! how old are you?");
int f=x.nextInt();
System.out.print(name+", you will be "+(f+10)+" after 10 years");
}
}
--------------------------------------------------------------------------------------------------------import javax.swing.JOptionPane;
public class XJOption
{
public static void main (String [] arg)
{
String x=JOptionPane.showInputDialog(null, "Enter your name? :");
String y=JOptionPane.showInputDialog(null, "hi "+x+"! how old are you?");
int B=Integer.parseInt(y);
JOptionPane.showMessageDialog(null, x+", you will be "+(B+10)+" after 10
years");
}
}
import java.util.Scanner;
public class Sum
{
public static void main (String[] args)
{
int A, B, S;
Scanner X = new Scanner(System.in);
System.out.print("Input the first number to add: ");
A = X.nextInt();
System.out.print("Input the second number to add: ");
B = X.nextInt();
S = A + B;
System.out.println("The sum of: "+A+" and: "+B+" is equal to: "+S);
}
}
-----------------------------------------------------------------------------------------------------------import java.util.Scanner;
public class SumAve
{
public static void main(String[] args)
{
double A, B, S, Ave;
Scanner X=new Scanner(System.in);
System.out.print("Enter 1st number: ");
A=X.nextInt();
System.out.print("Enter 2nd number: ");
B= X.nextInt();
S = (A+B);
System.out.println("The Sum is: "+S );
Ave = (S/2);
System.out.println("The Average is: "+Ave );
}
}
Download