Computer Science, asked by ncharshitha2005, 10 months ago

Can you please write the program for question 12 (bluej) using scanner class?

Attachments:

Answers

Answered by Amartya7
2

Answer:

Here's the answer :

Explanation:

import java.util.*;

class Amount

{

public static void main(String args[])

{

Scanner sc = new Scanner(System.in);

String name;

double am,amd;

System.out.println("Enter your name : ");

name = sc.nextLine();

System.out.println("Enter the amount of purchase : ");

am = sc.nextDouble();

if (am<=1000)

amd = am;

else if (am>1000 && am<=3000)

amd = 0.9 * am;

else if (am>3000 && am<=6000)

amd = 0.85 * am;

else if (am>6000)

amd = 0.8 * am;

System.out.println("Name"\t\t\t\t"Amount"\t\t\t\t"Amount Pay");

System.out.println(name\t\tam\t\t\t\tamd);

}//End of main method

}//End of class

Hope this helps.

Similar questions