Answered step by step
Verified Expert Solution
Question
1 Approved Answer
for my java class, i'm able to get the program to ask for 1 integer and 1 floating point. I need to help to getting
for my java class, i'm able to get the program to ask for 1 integer and 1 floating point. I need to help to getting it to ask for a two integers and 2 floating point between a min and max. Then display the sum of the two integers and two floating points.
what i need the to be:
4 import java .util. Scanner: 6 public class Summer 7 public static void main (String args) final double MINDOUBLE 1.0 10 11 final double MAX DOUBLE 20.0 12 final int MININT 10 13 final int MAXINT 20 14 15 Scanner in new Scanner System. in) 16 show the result of promptAndsum for doubles 17 System. out .printf The sum of your values is 4.2f prompt lin. MINDOUBLE, MANDOUBLE) 18 show the result of promptAndsum for ints 19 System. out printf ("The sum of your values is sd n", prompt (in MININT MAXINT) 20 21 22 prompt for an integer value 23 24 public static int prompt (Scanner in int min, int max) 25 final String STR PROMPT Please enter an integer between min and max 26 27 final String STR INVALID Invalid value, please try again. 28 int i min 1; 29 30 while (i k min. l i max) 31 32 33 System. out print (STR PROMPT); i in extInt 34 35 if (i main II i max) System. out.println (STR INVALID) 36 37 38 39 return. 40 41 prompt for a floating point value in the specified range 42 43 public static double prompt (Scanner in double min, double max) 44 min and max 45 final String STR PROMPT Please enter a floating point value between 46 final String STR INVALID Invalid value, please try again. 47 double d mln 1.0 48 49 while (d k min. l d max) 50 51 52 System. out print (STR PROMPT 53 in next Double 54 if (d main II d max) System. out.println (STR INVALID) 55 56 57 58 return d; 59 60Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started