File tree Expand file tree Collapse file tree 3 files changed +109
-0
lines changed
samueledward/Question 2.0 Expand file tree Collapse file tree 3 files changed +109
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * To change this license header, choose License Headers in Project Properties.
3
+ * To change this template file, choose Tools | Templates
4
+ * and open the template in the editor.
5
+ */
6
+ package classes ;
7
+
8
+ /**
9
+ *
10
+ * @author Samuel Edward
11
+ */
12
+
13
+ import java .util .Scanner ;
14
+
15
+ public class Circle {
16
+ public static void main (String args []) {
17
+ // Declaration of varriable
18
+ int radius , diameter ;
19
+ double circumfrence , area ;
20
+ double PI = 3.14159 ;
21
+
22
+ // Getting varriable from the user
23
+ Scanner sc = new Scanner (System .in );
24
+ System .out .println ("Enter the radius of a Circle: " );
25
+ radius = sc .nextInt ();
26
+
27
+ //Output Assignment
28
+ diameter = 2 * radius ;
29
+ circumfrence = PI * radius * 2 ;
30
+ area = PI * radius * radius ;
31
+
32
+ //Printing all the requiered variable to the console
33
+ System .out .println ("The value for the diameter : " + diameter );
34
+ System .out .println ("The value for the circumfrence: " + circumfrence );
35
+ System .out .println ("The value for the area : " + area );
36
+
37
+
38
+
39
+
40
+
41
+ }
42
+
43
+ }
Original file line number Diff line number Diff line change
1
+ //Compute the square and cubes
2
+ package classes ;
3
+
4
+ /**
5
+ *
6
+ * @author Samuel Edward
7
+ */
8
+ public class Square_and_Cubes {
9
+ public static void main (String args []) {
10
+
11
+ //Block for displaying the numbers itself
12
+ System .out .print ("The numbers are : " );
13
+ for (int i =1 ; i <=10 ; i ++){
14
+ System .out .print ( i );
15
+ if (i < 10 ) {
16
+ System .out .print ("," );
17
+ }else {
18
+ System .out .println ("." );
19
+ }
20
+ }
21
+ //Block for displaying the square of those numbers
22
+ System .out .print ("The numbers for the square are : " );
23
+ for (int i =1 ; i <=10 ; i ++){
24
+ System .out .print ( i *i );
25
+ if (i < 10 ) {
26
+ System .out .print ("," );
27
+ }else {
28
+ System .out .println ("." );
29
+ }
30
+ }
31
+
32
+ //Block for displaying the cube of those numbers
33
+ System .out .print ("The numbers for the cube are : " );
34
+ for (int i =1 ; i <=10 ; i ++){
35
+ System .out .print ( i *i *i );
36
+ if (i < 10 ) {
37
+ System .out .print ("," );
38
+ }else {
39
+ System .out .print ("." );
40
+ }
41
+ }
42
+
43
+
44
+ }
45
+ }
Original file line number Diff line number Diff line change
1
+
2
+ package classes ;
3
+
4
+ /**
5
+ *
6
+ * @author Samuel Edward
7
+ */
8
+ public class TOD {
9
+ public static void main (String args []) {
10
+
11
+ //Printing TOD
12
+ System .out .println (" *********** * *" );
13
+ System .out .println (" * * * * *" );
14
+ System .out .println (" * * * * *" );
15
+ System .out .println (" * * * * *" );
16
+ System .out .println (" * * * * *" );
17
+ System .out .println (" * * * * * *" );
18
+
19
+
20
+ }
21
+ }
You can’t perform that action at this time.
0 commit comments