diff --git a/samueledward/Question 2.0/Circle.java b/samueledward/Question 2.0/Circle.java new file mode 100644 index 0000000..74a33f2 --- /dev/null +++ b/samueledward/Question 2.0/Circle.java @@ -0,0 +1,43 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package classes; + +/** + * + * @author Samuel Edward + */ + +import java.util.Scanner; + +public class Circle { + public static void main (String args[]) { + // Declaration of varriable + int radius, diameter; + double circumfrence, area; + double PI = 3.14159; + + // Getting varriable from the user + Scanner sc = new Scanner(System.in); + System.out.println("Enter the radius of a Circle: "); + radius = sc.nextInt(); + + //Output Assignment + diameter = 2 * radius; + circumfrence = PI * radius * 2; + area = PI * radius * radius; + + //Printing all the requiered variable to the console + System.out.println("The value for the diameter : " + diameter); + System.out.println("The value for the circumfrence: " + circumfrence); + System.out.println("The value for the area : " + area); + + + + + + } + +} diff --git a/samueledward/Question 2.0/Square_and_Cubes.java b/samueledward/Question 2.0/Square_and_Cubes.java new file mode 100644 index 0000000..91b9ca9 --- /dev/null +++ b/samueledward/Question 2.0/Square_and_Cubes.java @@ -0,0 +1,45 @@ +//Compute the square and cubes +package classes; + +/** + * + * @author Samuel Edward + */ +public class Square_and_Cubes { + public static void main (String args []) { + + //Block for displaying the numbers itself + System.out.print("The numbers are : "); + for(int i =1; i<=10; i++){ + System.out.print( i); + if (i < 10) { + System.out.print(","); + }else { + System.out.println("."); + } + } + //Block for displaying the square of those numbers + System.out.print("The numbers for the square are : "); + for(int i =1; i<=10; i++){ + System.out.print( i*i); + if (i < 10) { + System.out.print(","); + }else { + System.out.println("."); + } + } + + //Block for displaying the cube of those numbers + System.out.print("The numbers for the cube are : "); + for(int i =1; i<=10; i++){ + System.out.print( i*i*i); + if (i < 10) { + System.out.print(","); + }else { + System.out.print("."); + } + } + + +} +} diff --git a/samueledward/Question 2.0/TOD.java b/samueledward/Question 2.0/TOD.java new file mode 100644 index 0000000..3dd9ad2 --- /dev/null +++ b/samueledward/Question 2.0/TOD.java @@ -0,0 +1,21 @@ + +package classes; + +/** + * + * @author Samuel Edward + */ +public class TOD { + public static void main (String args []) { + + //Printing TOD + System.out.println(" *********** * *"); + System.out.println(" * * * * *"); + System.out.println(" * * * * *"); + System.out.println(" * * * * *"); + System.out.println(" * * * * *"); + System.out.println(" * * * * * *"); + + + } +}