Home / Expert Answers / Computer Science / java-24-hour-time-also-known-in-the-u-s-as-military-time-is-widely-used-around-the-world-pa511

(Solved): **JAVA** 24-hour time (also known in the U.S. as military time) is widely used around the world. ...



**JAVA**

24-hour time (also known in the U.S. as military time) is widely used around the world. Time is expressed as hours since midnSummary: Given integer values for red, green, and blue, subtract the gray from each value.
Computers represent color by combi\begin{tabular}{l|l}  B & 4.24.1: LAB: Remove gray from RGB \end{tabular}
\( 0 / 10 \)
GrayRemoverRGB.java
Load default templ\( 4.25 \) LAB: Smallest number
Write a program whose inputs are three integers, and whose output is the smallest of the thre

24-hour time (also known in the U.S. as military time) is widely used around the world. Time is expressed as hours since midnight. The day starts at 00:00, and ends at 23:59. Write a program that converts \( \mathrm{am} / \mathrm{pm} \) time to 24 -hour time. The input is two numbers and a string. If the input is \( 230 \mathrm{pm} \), the output should be 14:30. If the input is \( 1201 \mathrm{am} \), the output should be 00:01. Hints: - Think of how each hour should be handled. \( 1200 \mathrm{am}-1259 \mathrm{am} \) becomes what? \( 800 \mathrm{am} \) becomes what? 1200 pm? 100 pm? Group the hours into cases that should be handled similarly (e.g., \( 100 \mathrm{am} \) to \( 1100 \mathrm{am} \) are handled the same). - Declare variables for hoursAmPm, minAmPm, and hours24. Note that minutes for 24-hour time remain the same as for am/pm, so no extra variable is needed. - Use an if-else statement to detect each case, and set the hours 24 appropriately. - When outputting hour24, check if the hour is \( 0-9 \) (just check for \( <10 \) ). If so, output a "0". So 7 will be output as 07. Do the same when outputting the minutes. \( 434764.2205612 \) qx3zoy \begin{tabular}{|l|l} LAB \\ ACTIVITY \end{tabular} 4.23.1: PRACTICE: 24-hour time \( \quad 0 / 6 \) _24HourTime.java Load default template... 1 import java.util.scanner; public class_24Hourtime \{ public static void main(string[] args) \{ Scanner scnr = new Scanner(System.in); I* Type your code here. */ \} Summary: Given integer values for red, green, and blue, subtract the gray from each value. Computers represent color by combining the sub-colors red, green, and blue (rgb). Each sub-color's value can range from 0 to 255 . Thus \( (255,0,0) \) is bright red, \( (130,0,130) \) is a medium purple, \( (0,0,0) \) is black, \( (255,255,255) \) is white, and (40, 40, 40) is a dark gray. \( (130,50 \), 130) is a faded purple, due to the \( (50,50,50) \) gray part. (In other words, equal amounts of red, green, blue yield gray). Given values for red, green, and blue, remove the gray part. Ex: If the input is: \( 130 \quad 50 \quad 130 \) the output is: 80080 Find the smallest value, and then subtract it from all three values, thus removing the gray. Note: This page converts rgb values into colors. \begin{tabular}{l|l} B & 4.24.1: LAB: Remove gray from RGB \end{tabular} \( 0 / 10 \) GrayRemoverRGB.java Load default template... import java.util.scanner; public class GrayRemoverRGB \{ public static void main(String[ ] args) \{ I* Type your code here. */ 3 \} Run your program as often as you'd like, before submitting for grading. Below, type any needed input values in the first box, then click Run program and observe the program's output in the second box. \( 4.25 \) LAB: Smallest number Write a program whose inputs are three integers, and whose output is the smallest of the three values. Ex: If the input is: 7153 the output is: 3 434764.2205612 qx3zqy7 \begin{tabular}{|l|l} LAB & 4.25.1: LAB: Smallest number \\ ACTIVITY & \end{tabular} SmallestNumber.java Load default template... 1 import java.util. Scanner; 3 public class smallestNumber \{ public static void main(string[] args) \{ /* Type your code here. */ \} \}


We have an Answer from Expert

View Expert Answer

Expert Answer


4.24 LAB: Remove gray from RGB CODE: import java.util.*; public class Main { public static int getMin(int arr[], int n) { int res = arr[0];
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe