-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPerson.java
More file actions
29 lines (25 loc) · 903 Bytes
/
Person.java
File metadata and controls
29 lines (25 loc) · 903 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
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author Administrator
*/
public class Person {
public int ageYears = 1;
public int ageDays;
public long ageMinutes, ageSeconds, ageMilliseconds;
// This method displays the values for an item
// This method displays the values for an item
public void calculateAge() {
ageDays = ageYears * 365;
ageSeconds = ageDays * 24 * 60 * 60;
ageMinutes = ageSeconds / 60;
ageMilliseconds = ageSeconds * 1000;
System.out.println("You are " + ageDays + " days old.");
System.out.println("You are " + ageSeconds + " seconds old.");
System.out.println("You are " + ageMinutes + " minutes old.");
System.out.println("You are " + ageMilliseconds + " milliseconds old.");
} // end of calculateAge method
}