Hey guys and i am new and in need of Immediate help !!
Alright here's the question:
Write a complete Java program that asks the user to enter the number of items. Then find
the following **WITHOUT USING ARRAYS:**
1- The value of the maximum item
2- The value of minimum item
3- The number of the items that are greater than 30
What i wrote:
Output:import java.util.*; public class Q2C { public static void main (String args []) { { int MaxV = 0; int NumV = 0; int MinV = 0; int i; int value = 0; for (i=0; i <= 10; i++) { System.out.println("Please Enter the value of the items:"); Scanner scan = new Scanner(System.in); value = scan.nextInt(); if (value < 100) MaxV=value+MaxV; else if (value > 50) MinV=value+MinV; else if (value <=30) NumV=NumV++; } System.out.println("Your Maximum value is "+MaxV); System.out.println("Your Minimum value is "+MinV); System.out.println("Your items that are valued more than 30 are " +NumV); }}}
Please Enter the value of the items:
1000
Please Enter the value of the items:
100
Please Enter the value of the items:
20
Please Enter the value of the items:
30
Please Enter the value of the items:
40
Please Enter the value of the items:
50
Please Enter the value of the items:
60
Please Enter the value of the items:
760
Please Enter the value of the items:
80
Please Enter the value of the items:
10
Please Enter the value of the items:
30
Your Maximum value is 320
Your Minimum value is 1860
Your items that are valued more than 30 are 0
But the output is COMPLETELY WRONG !!
Deadline is like Hours from now ----- HELP ME PLEASE !!!!!