Skip to content

Commit

Permalink
Create SumOfTheAges.java
Browse files Browse the repository at this point in the history
  • Loading branch information
giusepped committed Jul 19, 2014
1 parent 8b76b18 commit a1c286b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions SumOfTheAges.java
@@ -0,0 +1,21 @@

import java.util.Scanner;

public class SumOfTheAges {

public static void main(String[] args) {
Scanner reader = new Scanner(System.in);

// Implement your program here
System.out.println("Type your name: ");
String name1 = reader.nextLine();
System.out.println("Type your age: ");
int age1 = Integer.parseInt(reader.nextLine());
System.out.println("Type your name: ");
String name2 = reader.nextLine();
System.out.println("Type your age");
int age2 = Integer.parseInt(reader.nextLine());
int sumAges = age1 + age2;
System.out.println(name1 + " and " + name2 + " are " + sumAges + " years old in total.");
}
}

0 comments on commit a1c286b

Please sign in to comment.