Question: draw aflowchart loop Scanner scanner = new Scanner(System.in); double before500 = 0.70; double after500 = 0.50; int StaffNo = 20; for (int i = 1;
draw aflowchart loop
Scanner scanner = new Scanner(System.in); double before500 = 0.70; double after500 = 0.50; int StaffNo = 20;
for (int i = 1; i <= StaffNo; i++) { System.out.print("Enter the distance of the trip staff " + i + ": "); double distance = scanner.nextDouble(); double totalClaim = 0;
if (distance <= 500) { totalClaim = distance * before500; } else { totalClaim = (500 * before500) + ((distance - 500) *after500); }
System.out.println(" The Total mileage claim for staff " + i + ": RM" + totalClaim); } } }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
