Computer Science, asked by Mohan1m, 1 year ago

plase solve it using scanner class and please show the steps

Attachments:

Answers

Answered by angadanandishup8lt9m
1
import java.util.*;
class question 
{
public static void main(String args[])
{
Scanner sc = new Scanner (System.in);
System.out.println("if u r a dealer enter 1 and if if u r a retailer enter 2 /n the price for every meter paper is 10 rs");
int i = sc.nextInt();

if (i=1)
{ System.out.println("enter ur lenth of paper");
int n = sc.nextInt();
if(0<=n<= 10)
{
System.out.println("discount is 10%");
int sum = n*10*(90/100);
System.out.println("the amount to be paid after discount = " sum);
 }
if (10<n<=20);
{System.out.println("discount is 15%");
int sum = n*10*(85/100);
System.out.println("the amount to be paid after discount = " sum);
 }
if(20<n)
{System.out.println("discount is 20%");
int sum = n*10*(80/100);
System.out.println("the amount to be paid after discount = " sum);
 }
}
if (i=2)
{System.out.println("enter ur lenth of paper");
int n1 = sc.nextInt();
if(0<=n1= 10)
{
System.out.println("discount is 8%");
int sum = n1*10*(92/100);
System.out.println("the amount to be paid after discount = " sum);
 }
if (10<n<=20);
{System.out.println("discount is 10%");
int sum = n*10*(90/100);
System.out.println("the amount to be paid after discount = " sum);
 }
if(20<n)
{System.out.println("discount is 15%");
int sum = n*10*(85/100);
System.out.println("the amount to be paid after discount = " sum);
 }
}}}
Similar questions