Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a JAVA program that repeatedly asks a user for an integer until the user enters a value that is less than the previous value.
Write a JAVA program that repeatedly asks a user for an integer until the user enters a value that is less than the previous value. At that point, it calculates the average increment in the set of increasing values, rounded up to 2 decimal places.
This is the code i currently have but i am getting an out put of 12.5 when it should be 8.00....
Please help me rouynd the solutions to 2 decimal places and get the correct solutions.
import java.util.Scanner;
class AverageIncrements { public static void main(String args[]) { Scanner scanner = new Scanner(System.in); int pre, curr; pre = scanner.nextInt(); curr = scanner.nextInt(); double s = 0; int count = 0; while (pre
stepik.org UCS Problem Set-Step 3-Stepik The Resting Membrane Potent... juxtamedullary nephron ion ex...+ EC 4999.50 Code Challenge- Write a program, test using stdin -stdout Bad news. It's wrong Debug your code with your own inputs! Failed test 1. wrong answer Input: -14 Your output: Correct output: Hide Time Limit: 8 seconds Memory Limit: 256 MB 1 import java.util.scanner 3 class AverageIncrements 4 public static void main(String args]) Scanner scanner-new Scanner (System.in); int pre, curri pre = scanner.nextInt(); curr = scanner.next Int(); double s 0
Step 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