FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
programming/yahtzee/java/Input.java at master · Mrigank11/programming · GitHub
Mrigank11
/
programming
Public
forked from
hacktoberfest17/programming
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
programming
/
yahtzee
/
java
/
Input.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
46 lines (40 loc) · 1.14 KB
Breadcrumbs
programming
/
yahtzee
/
java
/
Input.java
Copy path
File metadata and controls
46 lines (40 loc) · 1.14 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
import
java
.
io
.
BufferedReader
;
import
java
.
io
.
IOException
;
import
java
.
io
.
InputStreamReader
;
/**
* Keyboard input functions. Doesn't validate user's input.
* Adapted code from university assignments.
* @author Professor Delamaro
*/
public
class
Input
{
static
InputStreamReader
isr
=
new
InputStreamReader
(
System
.
in
);
static
BufferedReader
br
=
new
BufferedReader
(
isr
);
/**
* Read a string typed by the user until \n
* @return string typed by the user
* @throws IOException
*/
public
static
String
readString
()
throws
IOException
{
String
x
;
x
=
br
.
readLine
();
return
x
;
}
/**
* Read a string and convert it to int. Doesn't validate user's input.
* @return value typed by the user
* @throws IOException
*/
public
static
int
readInt
()
throws
IOException
{
String
x
=
readString
();
return
Integer
.
parseInt
(
x
);
}
/**
* Read a string and convert it to double. Doesn't validate user's input.
* @return value typed by the user
* @throws IOException
*/
public
static
double
readDouble
()
throws
IOException
{
String
x
=
readString
();
return
Double
.
parseDouble
(
x
);
}
}
Back
|
FazBrowse Home
|
New Git URL