Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class L2Variables{
- public static void main(String[] args){
- //Let's create an integer
- int age = 82;
- String statement = "You have been on this earth for ";
- String units = " years";
- System.out.print(statement);
- System.out.print(age);
- System.out.println(units);
- //Write a program that says somebody's name
- //followed by their fave celebrity's name
- //Ex: (name)'s favorite celebrity is (celebrity)
- String name = "Blake";
- String celebrityName = "Beyonce";
- String inBetween = "'s favorite celeb is ";
- System.out.print(name);
- System.out.print(inBetween);
- System.out.println(celebrityName);
- //Write a program to calculate hours in a week
- int daysInAWeek = 7;
- int hoursInADay = 24;
- System.out.println( daysInAWeek * hoursInADay );
- //Bulk Candy Calculator
- double pricePerPound = 7.60;
- double weight = 40.5;
- System.out.println( pricePerPound * weight );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement