*
* @author lilu
*
*
Write a program that declares the following:
• a String variable named name
• an int variable named age
• a double variable named annualPay
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 similar to the following:
My name is Joe Mahoney, my age i s 26 and
I hope to earn $100000.0 per year.
*/
import java.util.Scanner;
import javax.swing.JOptionPane;
public class Strings {
public static void main(String[] args)
{
String name = "Joe Mahoney";//• a String variable named name
int age= 26; //• an int variable named age
double annualPay= 100000.0 ; //• a double variable named annualPay
//Output as requested.
System.out.println("My name is "+ name +
", my age is "+ age +
"and I hope to earn $" + annualPay + " per year."
);
}
}
fail
ReplyDelete