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

4 answers

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