Answered step by step
Verified Expert Solution
Link Copied!

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. image text in transcribed

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

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

Concepts Of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

4th Edition

0619064625, 978-0619064624

More Books

Students also viewed these Databases questions

Question

Has the team been empowered to prioritize the issues?

Answered: 1 week ago

Question

Have issues been prioritized?

Answered: 1 week ago

Question

Has the priority order been provided by someone else?

Answered: 1 week ago