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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!