Objective:

Imagine you're a software developer at a space agency, and they are about to launch a spacecraft. Before the launch, there is a traditional countdown. The countdown is usually conveyed via audio, but the agency wants a written log too. This log will be based on raw telemetry data received from the spacecraft.

Requirements:

Task:

You receive raw telemetry data in the following format: "D-100*T-10:30:45*STATUS:Ready"

· D- represents the number of days left for the launch.

· T- stands for the time left in hours, minutes, and seconds' format.

· After the second asterisk (*) is the current status of the spacecraft.

Your task is to:

· Extract this data and convert it into a more readable format.

· Calculate the total time left for the launch in minutes.

· Generate a status message based on the raw telemetry data.

Steps:

· Data Extraction:

· Identify the positions of the asterisks and hyphens in the string.

· Extract the number of days, time, and status message from the raw data string.

· Time Conversion:

· Convert the extracted time (which is in hours:minutes:seconds format) into total minutes using mathematical functions.

· Consider the days in your calculations. (1 day = 1440 minutes)

· Status Message Generation:

· If the character after "STATUS:" is an uppercase letter, display the status as it is. If it's a lowercase letter, convert it to uppercase before displaying. This ensures the status message always looks formal.

Deliverable:

Write a program in Java that takes the raw telemetry data string as input, performs the aforementioned steps, and outputs the status message and total minutes left for the launch.

Tips:

· Use String.indexOf() to find the position of specific characters or substrings in the string.

· String.split() can help in splitting the time format into hours, minutes, and seconds.

· Convert the extracted string numbers into integers using Integer.parseInt().

· Remember to use Math.round() or other relevant Math functions when needed.

Here is a possible implementation of the program in Java:

```java
import java.util.Arrays;

public class SpacecraftTelemetry {

public static void main(String[] args) {
String telemetryData = "D-100*T-10:30:45*STATUS:Ready";

// Data Extraction
int dayIndex = telemetryData.indexOf("D-") + 2;
int timeIndex = telemetryData.indexOf("T-") + 2;
int statusIndex = telemetryData.indexOf("STATUS:") + 7;

int days = Integer.parseInt(telemetryData.substring(dayIndex, timeIndex - 2));
String[] timeParts = telemetryData.substring(timeIndex, statusIndex - 8).split(":");
int hours = Integer.parseInt(timeParts[0]);
int minutes = Integer.parseInt(timeParts[1]);
int seconds = Integer.parseInt(timeParts[2]);

String status = telemetryData.substring(statusIndex);
if (Character.isLowerCase(status.charAt(0))) {
status = status.toUpperCase();
}

// Time Conversion
int totalMinutes = days * 1440 + hours * 60 + minutes;

// Output
System.out.println("Status: " + status);
System.out.println("Minutes left for launch: " + totalMinutes);
}
}
```

In this implementation, we use the `indexOf()` method to find the positions of the '*' and ':' characters in the telemetry data string. Then, we extract the number of days, the time (splitting it into hours, minutes, and seconds), and the status message using the `substring()` and `split()` methods.

Next, we convert the extracted time into total minutes by multiplying the number of days by 1440 (the number of minutes in a day), and adding the hours and minutes together.

Finally, we check if the first character in the status message is lowercase and convert it to uppercase if necessary. We then output the status message and the total minutes left for the launch.