Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Hello, Please help me to write this program, I am a begginer on java and I could

ID: 3542948 • Letter: H

Question

Hello, Please help me to write this program, I am a begginer on java and I couldn't figure it out. We are using java programming and we are using Eclipse to write our program in then run it on the command line. I need the program by using ( Conditionals and Loops ).
  • Mini-program: Write a console program that prompts the user for an integer. As long as the user keeps entering positive integers, continue prompting for the next integer. Once the user enters an integer of 0 or less, report the largest integer that was entered and end the program.

Thank you. Hello, Please help me to write this program, I am a begginer on java and I couldn't figure it out. We are using java programming and we are using Eclipse to write our program in then run it on the command line. I need the program by using ( Conditionals and Loops ).

Thank you. Please help me to write this program, I am a begginer on java and I couldn't figure it out. We are using java programming and we are using Eclipse to write our program in then run it on the command line. I need the program by using ( Conditionals and Loops ). Mini-program: Write a console program that prompts the user for an integer. As long as the user keeps entering positive integers, continue prompting for the next integer. Once the user enters an integer of 0 or less, report the largest integer that was entered and end the program.

Explanation / Answer



import java.util.ArrayList;

import java.util.Scanner;


public class LargestNumber


{

public static void main(String args[])

{

int ending=0;

ArrayList<Integer> list=new ArrayList<Integer>();

int value=1;

while(value>0)

{

System.out.println("Please Enter the number");

Scanner in=new Scanner(System.in);

value=in.nextInt();

ending =value;

if(value>0){

list.add(value);

}

}

int max=0;

for(int i=0;i<list.size();i++)

{

if(list.get(i).intValue()>max)

max=list.get(i).intValue();

}

System.out.println("largest number is=");

System.out.println(max);

}

}


Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote