Skip to content

Commit b5c0db2

Browse files
add membros estaticos
1 parent 63b9112 commit b5c0db2

File tree

6 files changed

+86
-2
lines changed

6 files changed

+86
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
| 🧱4 | Estrutura Sequencial | ✅ Concluído | 08/01/2025 |
2424
| 🧱5 | Estrutura Condicional | ✅ Concluído | 10/01/2025 |
2525
| 🧱6 | Estruturas Repetitivas | ✅ Concluído | 11/01/2025 |
26-
| 💾7 | Outros Tópicos Básicos sobre Java | 🔄 Em Progresso | 14/01/2025 |
27-
| 💾8 | Introdução à Programação Orientada a Objetos | ⏳ Próximo | - |
26+
| 💾7 | Outros Tópicos Básicos sobre Java | ✅ Concluído | 14/01/2025 |
27+
| 💾8 | Introdução à Programação Orientada a Objetos | 🔄 Em Progresso | 31/01/2025 |
2828
| 💾9 | Construtores, Sobrecarga, Encapsulamento | ⏳ Próximo | - |
2929
| 💾10 | Comportamento de Memória, Arrays, Listas | ⏳ Próximo | - |
3030
| 💾11 | Tópicos Especiais em Java: Date e Time | ⏳ Próximo | - |
436 Bytes
Binary file not shown.
1.24 KB
Binary file not shown.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
package Parte1.POO.Membros;
2+
3+
import java.util.Locale;
4+
import java.util.Scanner;
5+
6+
public class Membro1 {
7+
8+
public static final double PI = 3.14158;
9+
public static void main(String[] args) {
10+
11+
Scanner sc = new Scanner(System.in);
12+
Locale.setDefault(Locale.US);
13+
14+
15+
System.out.println("Enter radius: ");
16+
double radius = sc.nextDouble();
17+
18+
double c = circumference(radius);
19+
20+
double v = volume(radius);
21+
22+
23+
System.out.printf("Circumference: %.2f%n", c);
24+
System.out.printf("Volume: %.2f%n", v);
25+
System.out.printf("PI Value: %.2f%n", PI);
26+
27+
28+
sc.close();
29+
}
30+
31+
public static double circumference(double radius) {
32+
return 2.0 * PI * radius;
33+
}
34+
public static double volume(double radius) {
35+
return 4.0 * PI * radius*radius*radius/3.0;
36+
}
37+
38+
}
1.23 KB
Binary file not shown.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package Parte1.POO.Membros;
2+
3+
import java.util.Locale;
4+
import java.util.Scanner;
5+
6+
class Calculator{
7+
public final double PI = 3.14158;
8+
9+
public double circumference(double radius) {
10+
return 2.0 * PI * radius;
11+
}
12+
public double volume(double radius) {
13+
return 4.0 * PI * radius*radius*radius/3.0;
14+
}
15+
16+
}
17+
18+
public class Membro2 {
19+
public static void main(String[] args) {
20+
21+
Scanner sc = new Scanner(System.in);
22+
Locale.setDefault(Locale.US);
23+
24+
//instanciando objetos
25+
Calculator calc = new Calculator();
26+
27+
28+
System.out.println("Enter radius: ");
29+
double radius = sc.nextDouble();
30+
31+
double c = calc.circumference(radius);
32+
33+
double v = calc.volume(radius);
34+
35+
36+
System.out.printf("Circumference: %.2f%n", c);
37+
System.out.printf("Volume: %.2f%n", v);
38+
System.out.printf("PI Value: %.2f%n", calc.PI);
39+
40+
41+
sc.close();
42+
}
43+
44+
45+
46+
}

0 commit comments

Comments
 (0)