pseudocode for prgram i need to complete:
set MIN to 0.5
set MAX to 5.0
set cumulativeValue to 0
set count to 0
set more to ‘y’
while more is equal to ‘y’
set count to count + 1
print “Item number ” count “:”
set value to MIN - 1.0
while value is less than MIN or greater than Max
print “Enter value (” MIN “ < value < ” MAX “): ”
input value
set cumulativeValue to cumulativeValue + value
print “more? (y/n): ”
input more
set value to cumulativeValue / count
print “Average value = ” value
My current code:
import java.util.Scanner; public class exercise5 { public static void main(String[] args) { Scanner stdIn = new Scanner (System.in); double MIN = 0.5; double MAX = 5.0; double cumulativeValue = 0; int count = 0; int more = 'y'; String value; while (more = 'y'); int count = count++ ; System.out.print ("Item number" + count + ":"); double value = MIN -1.0; while (value < MIN || value > MAX) System.out.print ("Enter value(" + MIN + "<value<" + MAX + "):"); value = stdIn.nextLine(); double cumulativeValue = cumulativeValue + value; System.out.print ("more? (y/n):"); more = stdIn.nextLine(); input cumulativeValue / count; System.out.println("Average value =" value);
I know its pretty bad code but bare with me. Any help on how to fix this would be greatly appreciated.