Oop Java-Solution
Oop Java-Solution
QUESTION 1
Let's consider voting as an example. The basic criteria to vote in many countries is Age. If an individual is
18 or older, they are allowed to vote. Create a JAVA program for a Voting System using If-Statement.
In this example, since 20 is greater than 18, the program will output: "You are eligible to vote."
QUESTION 2
Here, since 15 is less than 18, our program will print: "You are not eligible to vote."
QUESTION 3
Design/Create a JAVA Program to Calculate Student Grade using If-else if statement. Suppose we're
categorizing grades of a student.
ASSIGNMENT QUESTION
Write a JAVA program to display two different students with their name and age.
QUESTION 5
Design a JAVA program For a Day Tracker using Switch Case Statement. for instance, consider a simple
day tracker:
Given the day is set to 2, our program will announce that it's "Tuesday".
Cautionary Note: The break keyword ensures that once a match is found and its corresponding block of
code is executed, the program exits the switch block
QUESTION 6
Increment Loop
QUESTION 7
Create a Java program using a for loop to simulate a traffic light sequence. Initialize a counter variable
lightIndex starting from 1. In each iteration, print "Green light" if lightIndex is 1, "Yellow light" if 2, "Red
light" if 3, and the current value of lightIndex otherwise. Use lightIndex++ to increment the counter.
PASS Q SOLUTION
(Q4b) Consider the following scenario where you have the first name and last name of a person.
Implement a java program that perform the following operation using string method.
1. concatenate the first name and last name to create full name.
2.calculate and print the length of the full name.
3. convert the first name to upper case and last name to lower case.
4. concatenate the modified first name and last name.
5. calculate and print the length of the modified full name.