Advertisement
Guest User

L2Variables.java

a guest
Dec 11th, 2018
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.03 KB | None | 0 0
  1. public class L2Variables{
  2.    public static void main(String[] args){
  3.       //Let's create an integer
  4.       int age = 82;
  5.       String statement = "You have been on this earth for ";
  6.       String units = " years";
  7.       System.out.print(statement);
  8.       System.out.print(age);
  9.       System.out.println(units);
  10.      
  11.       //Write a program that says somebody's name
  12.       //followed by their fave celebrity's name
  13.       //Ex: (name)'s favorite celebrity is (celebrity)
  14.       String name = "Blake";
  15.       String celebrityName = "Beyonce";
  16.       String inBetween = "'s favorite celeb is ";
  17.       System.out.print(name);
  18.       System.out.print(inBetween);
  19.       System.out.println(celebrityName);
  20.      
  21.       //Write a program to calculate hours in a week
  22.       int daysInAWeek = 7;
  23.       int hoursInADay = 24;
  24.       System.out.println( daysInAWeek * hoursInADay );
  25.      
  26.       //Bulk Candy Calculator
  27.       double pricePerPound = 7.60;
  28.       double weight = 40.5;
  29.       System.out.println( pricePerPound * weight );
  30.    }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement