-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathneopetObjects
More file actions
81 lines (67 loc) · 2.15 KB
/
Copy pathneopetObjects
File metadata and controls
81 lines (67 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
public class HelloWorld {
public static class Neopet{
String name;
String species;
String color;
String gender;
boolean scarf;
double strength;
double defense;
double movement;
Neopet(){
this.strength = 0.0;
this.defense = 0.0;
this.movement = 0.0;
}
};
public static void main(String[] args) {
// Write your code here 💖
// NEW NEOPET - GRAVATIA
Neopet gravatia = new Neopet();
gravatia.name = "Gravatia";
gravatia.species = "Eyrie";
gravatia.color = "Blue";
gravatia.gender = "F";
gravatia.scarf = false;
// Global variables
String scarfText;
String genderText;
if (gravatia.scarf){
scarfText = "don't have a scarf on her.";
} else {
scarfText = "has a scarf on her.";
};
if (gravatia.gender.equals ("F")){
genderText = "female";
} else {
genderText = "male";
};
System.out.println(gravatia.name + " is a Neopet from specie " + gravatia.species +
" and color " + gravatia.color + " of the gender " + genderText + " and " + scarfText);
System.out.println("S: " + gravatia.strength);
System.out.println("D: " + gravatia.defense);
System.out.println("M: " + gravatia.movement);
// NEW NEOPET - GOLDENBER
Neopet goldenber = new Neopet();
goldenber.name = "Goldenber";
goldenber.species = "Dragon";
goldenber.color = "Gold";
goldenber.gender = "M";
goldenber.scarf = true;
if (goldenber.scarf){
scarfText = "don't have a scarf on her.";
} else {
scarfText = "has a scarf on her.";
};
if (goldenber.gender.equals ("F")){
genderText = "female";
} else {
genderText = "male";
};
System.out.println("\n" + goldenber.name + " is a Neopet from specie " + goldenber.species +
" and color " + goldenber.color + " of the gender " + genderText + " and " + scarfText);
System.out.println("S: " + gravatia.strength);
System.out.println("D: " + gravatia.defense);
System.out.println("M: " + gravatia.movement);
}
}