the learner is asked to write a program using java with user input that caculate and displays, the number of months it will take the user to save an amount of money. the user must enter the

5. Write program prompt a user to enter student degree and determine if student is pass or fail?

Problem 1:

Create an array to store 10 names. Ask user to enter the name he/she wants to search and user search method to search the

name. If the name is there in the array, print 'Your name is already on the list'. Otherwise print 'you need to register

first'.

Problem 2:
Create an array to store 20 numbers. Ask user if he/she wants to 1) Sort the numbers in ascending order 2)sort the numbers

in descending order, or 3) search a number. to serve the choice of the user call sortAscending, sortDescending, or

searchNumber methods.
Display the results on the screen.

Problem 3:
Create a string array firstArray of size 10. Create another srting array secondArray of size 10.
Ask user to enter 10 random words and store them in firstArray.
Ask user if he/she wants to copy or move elements of firstArray to secondArray.
According copy or move the data from firstArray to secondArray.
If user has asked to copy display the elements of both arrays.
If the user asked to move, display the elements of secondArray.
Note: Use of methods is required.

Problem 5

----------------
The below program will print grade of a student based on marks:
-----------------------------------------------------------------------------------
import java.util.Scanner; // Import the Scanner class
public class MyClass {
public static void main(String[] args) {
Scanner myObj = new Scanner(System.in); // Create a Scanner object
System.out.println("Enter Mark of the student:");

int marks = myObj.nextInt(); // Read user input

System.out.println(marks);
if (marks < 0){
System.out.println("Invalid Number.");
}
else if(marks >=0 && marks <30){
System.out.println("Fail");
}
else if(marks >=30 && marks <50){
System.out.println("Grade D");
}
else if(marks >=50 && marks <65){
System.out.println("Grade C");
}
else if(marks >=65 && marks <80){
System.out.println("Grade B");
}
else if(marks >=80 && marks <=100){
System.out.println("Grade A");
}
else{
System.out.println("Invalid Number.");
}
}
}

www.alphacodingskills.com/java/java-if-else.php

To write a program in Java that calculates and displays the number of months it will take the user to save a certain amount of money, you can follow these steps:

1. Import the necessary classes for user input and console output:
```java
import java.util.Scanner;
```

2. Create a `Scanner` object to read user input:
```java
Scanner scanner = new Scanner(System.in);
```

3. Prompt the user to enter the target amount to be saved:
```java
System.out.print("Enter the target amount to be saved: ");
double targetAmount = scanner.nextDouble();
```

4. Prompt the user to enter the monthly savings amount:
```java
System.out.print("Enter the monthly savings amount: ");
double monthlySavings = scanner.nextDouble();
```

5. Prompt the user to enter the annual interest rate (in decimal form):
```java
System.out.print("Enter the annual interest rate (in decimal form): ");
double interestRate = scanner.nextDouble();
```

6. Calculate the number of months required to reach the target amount:
```java
double accumulatedAmount = 0;
int months = 0;
while (accumulatedAmount < targetAmount) {
accumulatedAmount += monthlySavings;
accumulatedAmount += accumulatedAmount * (interestRate / 12);
months++;
}
```

7. Display the result to the user:
```java
System.out.println("It will take " + months + " months to save $" + targetAmount);
```

8. Close the `Scanner` object:
```java
scanner.close();
```

Here's the complete code:

```java
import java.util.Scanner;

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

System.out.print("Enter the target amount to be saved: ");
double targetAmount = scanner.nextDouble();

System.out.print("Enter the monthly savings amount: ");
double monthlySavings = scanner.nextDouble();

System.out.print("Enter the annual interest rate (in decimal form): ");
double interestRate = scanner.nextDouble();

double accumulatedAmount = 0;
int months = 0;
while (accumulatedAmount < targetAmount) {
accumulatedAmount += monthlySavings;
accumulatedAmount += accumulatedAmount * (interestRate / 12);
months++;
}

System.out.println("It will take " + months + " months to save $" + targetAmount);

scanner.close();
}
}
```

By following these steps and using the provided code, you can write a Java program that calculates and displays the number of months it will take the user to save a specific amount of money.