Modify the CarRecall for Exercise Set 3 to allow the user to input as many model numbers as needed. Use 0 as a sentinel to end user input. ( Java programming )
Here you go:
The program terminates when the user inputs 0.
import java.util.Scanner;
public class Main {
public static void main(String []args) {
int num;
Scanner sc = new Scanner(System.in);
System.out.println("enter number: ");
while((num = sc.nextInt()) > 0) {
System.out.println("Keep Going!");
}
{
System.out.println("entered 0.");
System.exit(1);
}
}
}
========================================================
A sign of thumbs up would be appreciated.
Get Answers For Free
Most questions answered within 1 hours.