Ask Question
19 August, 07:19

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.

+3
Answers (1)
  1. 19 August, 10:32
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers