-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFamilyHistory.java
More file actions
44 lines (34 loc) · 1.46 KB
/
Copy pathFamilyHistory.java
File metadata and controls
44 lines (34 loc) · 1.46 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
// FamilyHistory.java
// Author: Te-Feng (Dylan) Pan
// Last Modified: 01/22/2013
// --------------------------
// This program reads in two people's names,
// city name, pet name, and animal type
// and prints them to the screen in a
// nicely story-formatted way.
import java.util.Scanner;
public class FamilyHistory
{
public static void main(String[] args)
{
String lName, fName, city, animalType, petName;
double height1, height2;
Scanner keyboard = new Scanner(System.in);
System.out.println("Please enter grandfather's last name:");
lName = keyboard.nextLine();
System.out.println("Please enter grandmather's first name:");
fName = keyboard.nextLine();
System.out.println("Please enter the city name they lived in:");
city = keyboard.nextLine();
System.out.println("Please enter the pet name:");
petName = keyboard.nextLine();
System.out.println("Please enter the animal type:");
animalType = keyboard.nextLine();
System.out.print(fName + " lived in a city named " + city + " many years ago. she had a " + animalType + "\n");
System.out.print("named " + petName + ".\n");
System.out.print(petName + " wandered away but was found by a fellow named Mr. " + lName + " who returned the\n");
System.out.print(animalType + ".\n");
System.out.print(fName + " was very happy that " + petName + " was home safely and that he brought\n");
System.out.print("with him Mr. " + lName + ", with whom she lived happily ever after!");
}
}