Answer:
import java.io.*;
public class Main
{
public static void main(String[] args) throws IOException {
BufferedReader bufferObject=new BufferedReader(new InputStreamReader(System.in));
String stringObject=bufferObject.readLine();
while(!stringObject.equals("99:99AM")){
System.out.println(convertedTime(stringObject));
stringObject=bufferObject.readLine();
}
}
public static String convertedTime(String stringObject){
String s=stringObject.substring(stringObject.length()-2);
String[] timeObject=stringObject.substring(0,5).split(":");
if(s.equals("AM")){
if(timeObject[0].equals("12")) return "00"+timeObject[1];
else return timeObject[0]+timeObject[1];
}
else{
if(timeObject[0].equals("12")) return "12"+timeObject[1];
else{
int hours=Integer.valueOf(timeObject[0]);
timeObject[0]=String.valueOf(12+hours);
return timeObject[0]+timeObject[1];
}
}
}
}
Explanation:
- Inside the main method run a while loop until stringObject is not equal to the string "99:99AM".
- Call the convertedTime method and display the results.
- Use the same hours and minutes except for 12th hour If the time is in AM.
- Use "00" instead of 12, if it is 12th hour.
- Add hours to 12, if the time is in PM and don't change anything in case of 12.
Answer and Explanation:
<u>The answer is 1. Created mock-ups of buildings.</u>
A mockup is a model or replica of a machine or structure, used for instructional or experimental purposes.
This is the answer because they needed the computer program to determine how their buildings should be constructed and getting measurements right without having to make it first physically and getting it wrong.
<u><em>#teamtrees #PAW (Plant And Water)</em></u>
Answer:
a) "Quit"
c) "Q only
Explanation:
Given
<em>String s = "Go"; </em>
<em>while ((!s.equals("q"))&& (!s.equals(""))) {</em>
<em>System.out.println("In loop"); </em>
<em>s = scnr.next();</em>
<em>}</em>
<em />
Required
What input causes another execution
Analyzing the while condition
<em>while ((!s.equals("q"))&& (!s.equals(""))) </em>
<em />
This can be split into:
<em>!s.equals("q")) && (!s.equals(""))</em>
<em />
Meaning
When s is not equal to "q" and when s is not an empty string
<em />
In other words,
the loop will be executed when user input is not "q" and user input is not empty.
So, from the list of given options: The loop both will be executed when:
a) Input is "Quit"
c) Input is Q only
<em>Input of q will terminate the loop, hence b and d are incorrect</em>
<em />