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/Seperater.java b/samueledward/Question 2.0/Seperater.java new file mode 100644 index 0000000..d011925 --- /dev/null +++ b/samueledward/Question 2.0/Seperater.java @@ -0,0 +1,39 @@ +/* + * 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; +import java.util.Scanner; +/** + * + * @author Samuel Edward + */ +public class Seperater { + + public static void main(String args[]) { + int num; + String [] arr = {}; + + Scanner sc = new Scanner( System.in); + System.out.print("Enter a long number: "); + num = sc.nextInt(); + + String value = String.valueOf(num); + + for (int i = 0; i <= value.length(); i++) { + String temp = value.substring(i); + temp = arr[i]; + } + + System.out.print("The Number you entered is: "); + + for(int i = 0; i <= value.length(); i++) { + System.out.println(arr[i]); + } + + + + } + +} 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(" * * * * * *"); + + + } +} diff --git a/samueledward/Question 3.0/Employee.java b/samueledward/Question 3.0/Employee.java new file mode 100644 index 0000000..463bf86 --- /dev/null +++ b/samueledward/Question 3.0/Employee.java @@ -0,0 +1,51 @@ +/* + * 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 + */ +public class Employee { + + private String firstName; + private String lastName; + private double salary; + + public Employee (String firstName, String lastName, double salary) { + this.firstName = firstName; + this.lastName = lastName; + } + + public String getfirstName() { + return firstName; + } + + public String getlastName() { + return lastName; + } + + public double getsalary() { + return salary; + } + + public void setFirstName(String firstName) { + this.firstName=firstName; + } + + public void setLastName(String lastName) { + this.lastName=lastName; + } + + public void setSalary(double salary) { + this.salary=salary; + } + + + + + +} diff --git a/samueledward/Question 3.0/EmployeeTest.java b/samueledward/Question 3.0/EmployeeTest.java new file mode 100644 index 0000000..273a407 --- /dev/null +++ b/samueledward/Question 3.0/EmployeeTest.java @@ -0,0 +1,59 @@ +/* + * 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; +import java.util.Scanner; + + +/** + * + * @author Samuel Edward + */ +public class EmployeeTest { + + public static void main(String args []) { + String firstName, lastName; + double salary; + + Scanner interger = new Scanner(System.in); + Scanner decimal = new Scanner(System.in); + + System.out.print("Enter the First Name: "); + firstName = interger.nextLine(); + + System.out.println("Enter the Last Name: "); + lastName = interger.nextLine(); + + System.out.println("Enter the salary: "); + salary = decimal.nextDouble(); + + Employee em1 = new Employee(firstName, lastName, salary); + + + System.out.println("The first name is: " + em1.getfirstName()); + System.out.println("The last name is: " + em1.getlastName()); + + if (salary >= 0) { + System.out.println("The salary is: " + em1.getsalary()); + } else { + System.out.println("The salary is not valid"); + } + } +} + + + + + + + + + + + + + } + +}