Total Expenses for the Event(Vardhan Raju);

 import java.util.*;


import java.io.*;

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();
    }
}

Tags

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.