REVISION-5
Steps:
Accepting User Input Start by accepting the three numbers as input from the user. You can use the Scanner class in Java to achieve this.
Comparing the Numbers Using conditional statements, compare the three numbers to find the largest one. We will use the if-else construct to handle the comparison.
Determining the Largest Number Within the if-else construct, compare the numbers using logical operators (>, <, >=, <=) to identify the largest value.
Displaying the Result Finally, print the largest number to the user.
Steps:
Accept the obtained marks and total marks as input from the user.
Calculate the percentage using the formula: (obtainedMarks / totalMarks) * 100.
Determine the grade based on the percentage using conditional statements.
Print the calculated percentage and assigned grade to the user.
Steps:
Start by accepting the water consumption from the user. You can use the Scanner class in Java to achieve this.
Using conditional statements, determine the rate per unit based on the consumption level. You will need to define the rate brackets and their corresponding rates.
Multiply the consumption by the applicable rate per unit to calculate the cost for each bracket. Sum up the costs for all the brackets to obtain the total bill.
Finally, print the total bill to the user.
Calculating Days in a Given Month
Steps:
We will start by accepting the month as input from the user. You can use the Scanner class in Java to achieve this.
Next, we will determine the number of days based on the input month. We will use an if-else conditional statement to handle the different cases.
For February, we need to check if the year is a leap year. If it is, the number of days will be 29; otherwise, it will be 28.
For the other months, we can use predefined values to determine the number of days. For example, January, March, May, July, August, October, and December have 31 days, while April, June, September, and November have 30 days.