Computer Science, asked by 9agauravkumarsharma, 3 months ago

correct the program
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int i, k, p;
double d=0,rp,np,tax;
String name, st;
System.out.println("enter name of customer ");
name=in.nextInt();
System.out.println("enter ur choice ");
k=in.nextInt();
if(k==1)
{
System.out.println("enter the amount ");
p=in.nextInt();
if(p<=20000)
d=p*5.0/100.0;
if(p>20000 && p<40000)
d=p*7.5/100.0;
if(p>40000 && p<60000)
d=p*10.0/100.0;
if(p>60000)
d=p*12.0/100.0;
rp=p-d;
tax=rp*12.5/100.0;
np=rp+tax;
System.out.println("customer s name "+name);
System.out.println("price of product "+p);
System.out.println("discount "+d);
System.out.println("tax"+tax);
System.out.println("amount to be paid "+np);
}
}
}

Answers

Answered by TJain9
1

Answer:

Import SCANNER

You have not imported the Scanner Class

Explanation:

Import Scanner class like this -->

import java.util.Scanner;   or write import java.util.*;

public class Main

{

public static void main(String args[])

{

your coding is write

}

}

Similar questions