Question: java code. For the following questions use if - else blocks. You need to write just few lines of java codes ( no class or

java code. For the following questions use if-else blocks. You need to write just few lines of java codes (no class or method codes needed):[8x5=40]
a. Write java codes to find the smaller between two integer values: val1=125 and val2=29. Declare and initialize the variables. Print the result with appropriate message.
b. Write java codes to find the smallest between four integer values: val1=125, val2=250, val3=50 and val4=75. Declare and initialize the variables. Print the result with appropriate message.
c. Score 94 to 100 is considered as letter grade A, score 91 to less than 94 is considered as letter grade A-, score 88 to less than 91 is considered as B+, score 84 to less than 88 is considered as B, score 81 to less than 84 is considered as B-. Write Java codes to print the message which letter grade a student got based on his/her score [example: System.out.println(The student got grade A)].
d. Write java codes to implement that if it is raining or if it is snowing we need to print the message: The weather is not favorable, otherwise print the message: The weather is favorable.
e. Write java codes to implement that if the student took less than 17 credits and if s/he got either A, or B or C in the pre-requisite course then s/he can enroll in the new course.
f. Write java codes to calculate interest for principal =1500.00 and interestRate =0.10(10%). Declare all the variables as double. Print the accrued interest with an appropriate message.
g. John travelled 100 km in 2 hours. Write java codes to calculate Johns average velocity in m/s (meter/sec). Make sure to convert the units properly.
h. Jane had one hundred $1 bills and she equally distributed the $1 bills among 12 people. How many $1 bills will be left? Write java codes to solve the problem. You will need 3 variables: totalBills, totalPeople, and remainingBills. You may declare all of those a integer type.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!