Question: 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. Write a JAVA program that repeatedly asks a user for an integer

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

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!