import java.util.Scanner;
public class Main
{
public static void main(String[] args) {
String name;
double cprice;
int duration;
Scanner in=new Scanner(System.in);
System.out.println("Enter name: ");
name=in.next();
System.out.println("Enter current price: ");
cprice=in.nextDouble();
System.out.println("Enter duration: ");
duration=in.nextInt();
double retail_price=0.0;
if(duration<=7)
retail_price=1.20*cprice;
else if(duration>7 && duration<=14)
retail_price=1.15*cprice;
else if(duration>14)
retail_price=1.02*cprice;
System.out.println("Name: "+name);
System.out.println("Current price: "+ cprice);
System.out.println("Duration: "+ duration);
System.out.println("Retail price: "+ retail_price);
}
}
Comments
Leave a comment