You are on page 1of 2

import java.util.

Scanner;

import java.util.*;

public class Main {

public static void main(String[] args) throws Exception{

double brandExp,travExp,foodExp,logiExp;

double brandExpPe,travExpPe,foodExpPe,logiExpPe;

Scanner sc = new Scanner(System.in);

System.out.println("Enter branding expenses");

brandExp = sc.nextDouble();

System.out.println("Enter travel expenses");

travExp = sc.nextDouble();

System.out.println("Enter food expenses");

foodExp = sc.nextDouble();

System.out.println("Enter logistics expenses");

logiExp = sc.nextDouble();

double totExp = brandExp+travExp+foodExp+logiExp;

System.out.println("Total expenses: Rs."+String.format("%.2f",totExp));

brandExpPe = ( brandExp/totExp )*100;

travExpPe = ( travExp/totExp )*100;

foodExpPe = ( foodExp/totExp )*100;

logiExpPe = ( logiExp/totExp )*100;

System.out.println("Branding expenses percentage:"+String.format("%.2f",brandExpPe)+"%");

System.out.println("Travel expenses percentage:"+String.format("%.2f",travExpPe)+"%");

System.out.println("Food expenses percentage:"+String.format("%.2f",foodExpPe)+"%");

System.out.println("Logistics expenses percentage:"+String.format("%.2f",logiExpPe)+"%");

sc.close();

import java.util.*;
import java.io.*;class Main{

public static void main(String[] args) throws Exception{

int age;

Scanner sc = new Scanner(System.in);

age=sc.nextInt();

if(age < 15 || age > 60)

System.out.println("Not Allowed");

else

System.out.println("Allowed");

if(sc!=null)

sc.close();

You might also like