Kali ini saya akan membagikan cara menghiting tips pada pemrograman java, .
Silahkan dicoba, . .
import java.util.Scanner;
public class CalculateTips {
public static void main(String[] iriahus) {
@SuppressWarnings("resource")
Scanner s = new Scanner(System.in);
System.out.print("Enter the subtotal value: ");
double sub = s.nextDouble();
System.out.print("Enter the gratuity rate: ");
double gratuity = s.nextDouble();
double total = sub * (1 + gratuity / 100);
System.out.println("$" + (sub * gratuity / 100) + " is the gratuity" +
" and the total is $" + total);
}
}
Semoga bermanfaat, . .
0 Response to "Menghitung Tips"
Post a Comment