Skip to content

Commit 5384583

Browse files
Name, Age and Annual Income
1 parent ed14617 commit 5384583

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package com.challenges;
2+
3+
/*
4+
Write a program that declares the following:
5+
• a String variable named name
6+
• an int variable named age
7+
• a double variable named annualPay
8+
Store your age, name, and desired annual income as literals in these variables. The program should display these values on the screen in a manner
9+
similar to the following:
10+
11+
My name is Joe Mahoney, my age is 26 and
12+
I hope to earn $100000.0 per year.
13+
*/
14+
15+
public class NameAgeAnnualIncome {
16+
17+
public static void main(String [] args) {
18+
19+
// Declare Variables
20+
String name = "Joe Mahoney";
21+
int age = 26;
22+
double annualPay = 100000.0;
23+
24+
// Print out details
25+
System.out.print("My name is " + name + ", my age is " + age + " and\nI hope to earn $" + annualPay + " per year.");
26+
27+
}
28+
}

0 commit comments

Comments
 (0)