Question: Use Java to write these programs 1. Write a program that does the following: Prompt the user to enter two integer values (n 1 and

Use Java to write these programs  Use Java to write these programs 1. Write a program that

1. Write a program that does the following: Prompt the user to enter two integer values (n 1 and n2) Output messages indicating which number is larger, which number is smaller, whether or not they are equal. Determine whether or not n2 is a factor of n1. a. b. c. 2. A person's BMI (body mass index) is calculated with the following formula: BMI Weight x 703 / Height? Write a program that asks the user to enter weight (pounds) and height (inches), then calculates and outputs the BMI. The program should also print a message indicating whether the person has optimal weight (The BMI is between 18.5 and 25), is underweight (The BMI is less than 18.5), or is overweight (The BMI is greater than 25). User input should be validated. Print an error message if the input is invalid. You can combine two expressions using a logical operator (AND/OR). 3. A wholesale company sells a product for $25.99 apiece. The store gives the customers discounts based on the following table: Discount Rate 10% 15% 25% 35% Quantity to Purchase 10-25 26-50 51 -75 76- 100 101 or more | 50% asks the user to enter the quantity to purchase, then calculates and outputs Write a program that the discount (if any) and the total amount of the purchase after discount. User input should be validated. Print an error message if the input is invalid. It is required to use multiple selection structure. of gasoline. The retail prices are shown below 4. A gas station sells three different grades Gas Grade Type Price per Gallon Sah . Regular Plus $2.65 $2.89 3.19 87 89 5Premium 93 Write a program that asks the user to enter the gas grade and the gallons sold, then calcula outputs the price before tax. tes and User input should be validated. Print an error message if the input is invalid, It is required to use switch selection structure

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!