From dcd6b49fc604827553a0e26edcb0bd1ab3a77bf7 Mon Sep 17 00:00:00 2001 From: Samuel Edward Date: Sun, 1 Dec 2019 14:19:03 +0100 Subject: [PATCH 1/4] Issue 2.19 solved --- samueledward/Question 2.0/Circle.java | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 samueledward/Question 2.0/Circle.java 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); + + + + + + } + +} From 5abd1c32f64a4e1538fa2515e9409948660cb175 Mon Sep 17 00:00:00 2001 From: Samuel Edward Date: Mon, 2 Dec 2019 08:37:07 +0100 Subject: [PATCH 2/4] insert those 2 --- .../Question 2.0/Square_and_Cubes.java | 45 +++++++++++++++++++ samueledward/Question 2.0/TOD.java | 21 +++++++++ 2 files changed, 66 insertions(+) create mode 100644 samueledward/Question 2.0/Square_and_Cubes.java create mode 100644 samueledward/Question 2.0/TOD.java 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(" * * * * * *"); + + + } +} From 9f67e45c6cf3c244cab0bdb472cb284f3fa8acf4 Mon Sep 17 00:00:00 2001 From: Samuel Edward Date: Fri, 6 Dec 2019 05:33:07 +0100 Subject: [PATCH 3/4] It was a little bit tricky.pleas check if correct --- samueledward/Question 2.0/Seperater.java | 39 ++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 samueledward/Question 2.0/Seperater.java 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]); + } + + + + } + +} From d83e9234dfe841ca89205beb9a94ed3f24c5c8a0 Mon Sep 17 00:00:00 2001 From: Samuel Edward Date: Sat, 7 Dec 2019 15:12:54 +0100 Subject: [PATCH 4/4] This is for the Employee question --- samueledward/Question 3.0/Employee.java | 51 ++++++++++++++++++ samueledward/Question 3.0/EmployeeTest.java | 59 +++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 samueledward/Question 3.0/Employee.java create mode 100644 samueledward/Question 3.0/EmployeeTest.java 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"); + } + } +} + + + + + + + + + + + + + } + +}