Ask Question
13 July, 23:12

Insurance companies suggest that people should insure a building for at least 80 percent of the cost to replace it. Write a program that accepts the cost of a building, sends it to a method which calculates the recommended insurance, and then displays the result in a currency format.

+2
Answers (1)
  1. 14 July, 00:10
    0
    Program 1:

    import java. util.*;

    class Kilo

    {

    public static void main (String[] args)

    {

    Scanner sc = new Scanner (System. in);

    System. out. println ("Enter distance in Kilometers ");

    double Kilometers = sc. nextDouble ();

    double dist = KiloToMeters (Kilometers);

    System. out. println ("The kilometers in miles : "+dist);

    }

    public static double KiloToMeters (double Kilometers)

    {

    double Miles = Kilometers * 0.6214;

    return Miles;

    }

    }

    Program 2:

    import java. text. NumberFormat;

    import java. util.*;

    public class Insurance {

    public static void main (String[] args) {

    System. out. println ("Enter the cost of building:");

    Scanner sc=new Scanner (System. in);

    Double building=sc. nextDouble ();

    double cost = calc (building);

    NumberFormat val = NumberFormat. getCurrencyInstance ();

    System. out. println ("Insurance amount:" + val. format (cost));

    }

    private static double calc (Double building)

    {

    Double insurance_cost;

    insurance_cost = (building*80/100);

    return insurance_cost;

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Insurance companies suggest that people should insure a building for at least 80 percent of the cost to replace it. Write a program that ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers