-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDavosClient.java
More file actions
157 lines (99 loc) · 3.15 KB
/
DavosClient.java
File metadata and controls
157 lines (99 loc) · 3.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
public class DavosClient
{
public static void main (String[] args) {
int age = 0;
int val = 0;
int val_2 = 0;
int time = 0;
int find = 0;
int prim_num_cl = 0;
int num_1 = 0;
int num_2 = 0;
int prim_sum = 0;
int try_1 = 0;
int correct_letter_num = 0;
String next = "";
String name = "";
String word_1 = "";
String sam_1 = "";
String sam_2 = "";
String choice = "";
String binary = "";
char last = ' ';
char check = ' ';
char quess_letter = ' ';
char correct_letter = ' ';
boolean pri_num_boo = false;
System.out.println ("What is your age?");
age = SavitchIn.readLineInt();
name = " ";
DavosClass dav = new DavosClass(age, name, time, word_1);
System.out.println (dav.ageDiv());
System.out.println ("Enter a number:");
val = SavitchIn.readLineInt();
System.out.println ("enter a second number?");
choice = SavitchIn.readLine();
if(choice.equalsIgnoreCase("yes"))
{
System.out.println ("Enter a second number:");
val_2 = SavitchIn.readLineInt();
System.out.println (dav.abs(val,val_2));
}
else
{
System.out.println (dav.abs(val));
}
System.out.println ("Enter a word:");
next = SavitchIn.readLine();
System.out.println (dav.nextToLast(next));
System.out.println ("What is your name:");
name = SavitchIn.readLine();
DavosClass dav_1 = new DavosClass(age, name, time, word_1);
System.out.println ("Enter a number:");
time = SavitchIn.readLineInt();
System.out.println ("Enter a word:");
word_1 = SavitchIn.readLine();
name = " ";
System.out.println ();
DavosClass dav_2 = new DavosClass(age, name, time, word_1);
System.out.println ();
System.out.println ("Enter a word:");
word_1 = SavitchIn.readLine();
System.out.println ("Enter a letter:");
check = SavitchIn.readLineNonwhiteChar();
find = dav_2.findIndex(word_1,check);
System.out.println (find);
System.out.println ("Enter a number:");
prim_num_cl = SavitchIn.readLineInt();
pri_num_boo = dav_2.primeNum(prim_num_cl);
System.out.println ("# is prime: " +pri_num_boo);
System.out.println ("Enter first number:");
num_1 = SavitchIn.readLineInt();
System.out.println ("Enter second number:");
num_2 = SavitchIn.readLineInt();
prim_sum = dav_2.getPrimez(num_1,num_2);
System.out.println (prim_sum+ " prime number(s)");
System.out.println ("Enter a number:");
num_1 = SavitchIn.readLineInt();
System.out.println (dav_2.sumOfDigits(num_1));
System.out.println ("Enter a word:");
sam_1 = SavitchIn.readLine();
System.out.println ("Enter a second word?");
choice = SavitchIn.readLine();
if(choice.equalsIgnoreCase("yes"))
{
System.out.println ("Enter a second word:");
sam_2 = SavitchIn.readLine();
System.out.println (dav_2.same(sam_1,sam_2));
}
else
{
System.out.println (dav_2.same(sam_1));
}
System.out.println ("Enter a 8-bit binary number:");
binary = SavitchIn.readLine();
System.out.println ("converted binary number is:");
System.out.println (dav_2.converToDecimal(binary));
dav_2.letterGame();
}
}