import java.util.Scanner; public class Task10 { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.print("Enter sales amount: "); double sales = scanner.nextDouble(); double fixedSalary = 25000; double commission; double bonus = 0; if (sales <= 100000) { commission = 0.02 * sales; } else if (sales > 100000 && sales < 300000) { commission = 0.015 * sales; bonus = 2000; } else { commission = 0.01 * sales; bonus = 3000; } double totalSalary = fixedSalary + commission + bonus; System.out.println("Total salary: " + totalSalary); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter