package yearendbonus; import java.util.Scanner; public class YearEndBonus { /** * @param args the command line arguments */ public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the employee's name: "); String name = input.nextLine(); System.out.print("Enter the employee's monthly salary: "); double salary = input.nextDouble(); double bonus; if (salary < 2000) { bonus = salary * 0.5; } else { bonus = 1500; } System.out.println(name + "'s bonus is: " + bonus); } }
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