Answer:
Explanation:
The following code is written in Java. It creates the loop as requested and validates the information provided before continuing, if the information is invalid it prints "Invalid Information to the screen" and asks the user to enter the information again. Finally, outputing all the requested information at the end of the program. The code has been tested and the output can be seen in the attached image below.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Scanner;
class Brainly {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int totalValues = 0;
int totalTaxes = 0;
int count = 0;
while(true) {
int lotNumber, value;
double tax;
System.out.println("Would you like to add an Entry: 1=Yes 0=No");
int answer = in.nextInt();
if (answer == 1) {
System.out.println("Please enter lot number: ");
lotNumber = in.nextInt();
if ((lotNumber >= 0) && (lotNumber <= 999999)) {
System.out.println("Please enter assessed value: ");
value = in.nextInt();
tax = value * 0.05;
System.out.println("Lot Number: " + lotNumber);
System.out.println("Property Value: " + value);
System.out.println("Property Tax: " + tax);
totalTaxes += tax;
totalValues += value;
count += 1;
} else {
System.out.println("Invalid Lot Number");
}
} else {
break;
}
}
int average = totalTaxes / count;
System.out.println("Total Property Values: " + totalValues);
System.out.println("Total Property Taxes: " + totalTaxes);
System.out.println("Average Property Tax" + average);
}
}