Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

4. Support and enliven your speech with effective research

Answered: 1 week ago

Question

3. Choose an appropriate topic and develop it

Answered: 1 week ago