Java Basics Task 1
Java Basics Task 1
Note:
1. Try to solve the problems just get the logic from google and try to implement the
logic on your own.
2. Run the logic in Eclipse and Write all the solu on in a word document ques on and
answer below. Below is the sample:
1. Check Posi ve or Nega ve:
public sta c void main(String[] args) {
scanner = new Scanner(System.in);
System.out.print("Enter a number: ");
double number = scanner.nextDouble();
if (number > 0) {
System.out.println("The number is posi ve.");
}
else if (number < 0) {
System.out.println("The number is nega ve.");
}
else {
System.out.println("The number is zero.");
}
scanner.close();
}
30 Simple Problems:
1. Check Posi ve or Nega ve
- Write a program to check whether a number is posi ve or nega ve using `if-else`.
3. Vowel or Consonant
- Check if a given character is a vowel or consonant using `if-else`.
4. Simple Calculator
- Implement a simple calculator using a `switch` statement to perform addi on, subtrac on,
mul plica on, or division.
5. Grade Assignment
- Assign a grade (A, B, C, D, F) based on a score input by the user using `if-else`.
30 Medium-Level Problems
7. Matrix Addi on
- Perform matrix addi on using nested `for` loops.