Make a Function to input total and calculate discount for following condition.
a. If total > = 10000 then discount = 25%
b. If total > = 5000 then discount = 10%
c. Else discount = 5%
Answers
I'm making the function in Java.
____________________________
package test.brainly;
import java.util.Scanner;
public class check {
public static void discount(int total){
int discount = 0;
if (total >= 10000) discount = total*25/100;
else if (total >= 5000) discount = total*10/100;
else discount = total*5/100;
return discount;
}
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.print("Enter Price of the Item : ");
int total = sc.nextInt();
int d = discount(total);
System.out.println("The discount for the given price is : "+d);
System.out.println("The final price is"+(total-d));
}
}
________________________________
Hope this helps.
Please Mark this the Brainliest.
I worked whole night but got only 3 Brainliest markings even when all my answer were correct.