Write a Java application that computes and prints the grade of a student according to the following algorithm:

1) It should read from the user TMA score and MTA score.
2a) If their sum is less than 15, the grade "FC" should be printed and the program will stop.
2b) Otherwise, 2b1) It will read from the user final exam score. 2b2a) If it is less than 20, the grade "FF" should be printed and the program will stop. 2b2b) Otherwise, 2b2b1) If the total score (sum of all scores) is less than 50, the grade "F" should be printed. 2b2b2) Otherwise, the grade "P" should be printed
b. Give the exact output of your application.

Homework Posting Tips

Please show your work. Tutors will not do your homework for you. Please show your work for any question that you are posting.

Sure! Here's a step-by-step guide on how to write a Java application that computes and prints the grade of a student based on the provided algorithm:

1. Start by creating a new Java class named "GradeCalculator".

```java
public class GradeCalculator {
public static void main(String[] args) {
// Rest of the code will go here.
}
}
```

This is the basic structure of a Java program with a main method.

2. Inside the main method, you need to read the TMA and MTA scores from the user.

```java
import java.util.Scanner;

public class GradeCalculator {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.print("Enter TMA score: ");
int tmaScore = scanner.nextInt();

System.out.print("Enter MTA score: ");
int mtaScore = scanner.nextInt();

// Rest of the code will go here.
}
}
```

Here, we are using the Scanner class to read the input from the user.

3. Next, we need to check if the sum of TMA and MTA scores is less than 15 and print "FC" if it is. Otherwise, we move to the next step of reading the final exam score.

```java
import java.util.Scanner;

public class GradeCalculator {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.print("Enter TMA score: ");
int tmaScore = scanner.nextInt();

System.out.print("Enter MTA score: ");
int mtaScore = scanner.nextInt();

int sum = tmaScore + mtaScore;

if (sum < 15) {
System.out.println("FC");
return;
}

System.out.print("Enter final exam score: ");
int finalExamScore = scanner.nextInt();

// Rest of the code will go here.
}
}
```

4. If the sum is not less than 15, we move to the next step and read the final exam score from the user.

5. After reading the final exam score, we need to check the conditions based on the algorithm and print the appropriate grade.

```java
import java.util.Scanner;

public class GradeCalculator {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);

System.out.print("Enter TMA score: ");
int tmaScore = scanner.nextInt();

System.out.print("Enter MTA score: ");
int mtaScore = scanner.nextInt();

int sum = tmaScore + mtaScore;

if (sum < 15) {
System.out.println("FC");
return;
}

System.out.print("Enter final exam score: ");
int finalExamScore = scanner.nextInt();

int totalScore = sum + finalExamScore;

if (finalExamScore < 20) {
System.out.println("FF");
} else if (totalScore < 50) {
System.out.println("F");
} else {
System.out.println("P");
}
}
}
```

6. Finally, compile and run the program. The program will prompt the user to enter the TMA score, MTA score, and final exam score. Based on the input, it will compute and print the corresponding grade according to the provided algorithm.

Here's the expected output for various inputs:

- Example 1:
- TMA score: 10
- MTA score: 6
- Final exam score: 25
- Output: P

- Example 2:
- TMA score: 8
- MTA score: 5
- Final exam score: 18
- Output: F

- Example 3:
- TMA score: 4
- MTA score: 2
- Final exam score: 15
- Output: FC

- Example 4:
- TMA score: 12
- MTA score: 10
- Final exam score: 12
- Output: FF

I hope this helps! Let me know if you need any further assistance.