/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
*
*
*/
public class LanguageBasics {
public static void invokeMe(){
String greeting = “Bonjour,”;
String myPawPrint = “12345”;
SimpleDateFormat df = new SimpleDateFormat(“MM/dd/yyyy HH:mm”);
System.out.print(greeting+” my pawprint is “+ myPawPrint+” and today’s date is “+df.format(new Date()));
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
char c1 = 'A';
char c2 = 65;
short qualityScore = 70;
float gravitation = (float) 9.8;
float weight = 50;
boolean sunny = true;
boolean warm = false;
Calendar a = Calendar.getInstance();
int hour = a.get(Calendar.HOUR_OF_DAY);
int minute = a.get(Calendar.MINUTE);
if(c1 != c2){
System.out.println(c1 +" and "+c2 + " are NOT the same");
}
else{
System.out.println(c1 +" and "+c2 + " are the same.");
}
if(qualityScore>=0&&qualityScore<=60){
System.out.println("The quality is bad.");
}
else{
System.out.println("Good quality.");
}
float force = weight * gravitation;
System.out.println("Force = "+force);
if(sunny==true&&warm==true){
System.out.println( "Go hiking.");
}
else if(sunny==false&&warm==true){
System.out.println( "Go barbeque.");
}
else{
System.out.println( "Stay home.");
}
//5-10 morning hour>=5&&hour<=10 "The current time is 08:08 in the MORNING."
//11-16 afternoon hour>=11&&hour<=16 "The current time is 08:08 in the AFTERNOON."
//17-22 evening hour>=17&&hour<=22 "The current time is 08:08 in the EVENING."
//23-4 night hour>=23&&hour<=24&&hour>=0&&hour<=4 "The current time is 08:08 in the NIGHT."
//0-23 wrong "You have the wrong time."
int b = ((hour>=5&&hour<11)==true?1:0)
+((hour>=11)==true?1:0)
+((hour>=11&&hour<17)==true?1:0)
+((hour>=17)==true?1:0)
+((hour>=17&&hour<23)==true?1:0)
+((hour>=23)==true?1:0)
+((hour>=23&hour<=24)==true?1:0)
+((hour>=0&hour<=4)==true?5:0);
switch(b){
case 1:
System.out.println("The current time is "+hour + ":" +minute+" in the MORNING.");
break;
case 2:
System.out.println("The current time is "+hour + ":" +minute+" in the AFTERNOON.");
break;
case 3:
System.out.println("The current time is "+hour + ":" +minute+" in the EVENING.");
break;
case 4:
System.out.println("The current time is "+hour + ":" +minute+" in the NIGHT.");
break;
case 5:
System.out.println("The current time is "+hour + ":" +minute+" in the NIGHT.");
break;
default:
System.out.println("You have the wrong time.");
}
for (int count = 2; count <= 6; count++) {
if(count%3==0){
System.out.println("Count:"+count);
}
}
int countDown = 5;
while(countDown>=0){
System.out.println("Count Down:"+countDown);
countDown = countDown-1;
}
System.out.println("“Houston, we have a lift off!”");
invokeMe();
// TODO code application logic here
}
}