-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathInputOutput.shadow
More file actions
36 lines (27 loc) · 855 Bytes
/
InputOutput.shadow
File metadata and controls
36 lines (27 loc) · 855 Bytes
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
import shadow:io@Console;
class InputOutput
{
public main( String[] args ) => ()
{
Console con;
String name, school, home, temp;
int age;
//prompt the user for basic information
con.print("\nWhat's your name? ");
(name, ) = con.readLine();
con.printLine();
con.print("How old are you? ");
(temp, ) = con.readLine();
//convert string to int to get the age
age = temp.toInt();
con.printLine();
con.print("Where are you from? ");
(home, ) = con.readLine();
con.printLine();
con.print("What school do you attend? ");
(school, ) = con.readLine();
con.printLine();
//print out their info, variable are added with a '#' differentiating them
con.printLine(name # " is " # age # " years old. They are from " # home # " and currently attending " # school # ".\n");
}
}