Question

In: Computer Science

IST Insurance Brokers, Inc. needs your help to create a program to calculate the total cost of insurance policies issued by its brokers.

Note: For input/output, you must use the JOptionPane class.

IST Insurance Brokers, Inc. needs your help to create a program to calculate the total cost of insurance policies issued by its brokers. Write a small Java program that prompts the user for a type of insurance policy and then determines the total policy cost.

The company currently supports only three types of insurance policies: Apartment, Auto, and Condo. When a user enters a different type of insurance policy, they should be told the program does not support that type of insurance policy at this time.

Use the information below to determine total policy cost:

Apartment - Has a base cost of $300.00 with the option to purchase premium protection for an additional $175.00
Auto - Has a base cost of $200.00
Condo - Has a base cost of $300.00 with the option to purchase premium protection for an additional $175.00

Solutions

Expert Solution

package form;

import javax.swing.JOptionPane; // Needed for Dialog Box

/**

* This program demonstrates

* showInputDialog.

*/

public class ISTInsuranceBrokers

{

public static void main(String[] args)

{

while(true){

String policy;

double totalCost=0;

String options = "Please enter anyone of the below policy type"+

"\n1. Apartment"+

"\n2. Auto"+

"\n3. Condo";

policy = JOptionPane.showInputDialog(options);

if(policy!=null){

if(policy.equalsIgnoreCase("Apartment") || policy.equalsIgnoreCase("Condo")){

totalCost+=300;

int val = JOptionPane.showConfirmDialog(null,

"Would you like to purchase premium protection for an additional $175.00",

"Addional info!!!",

JOptionPane.YES_NO_OPTION);

if(val==0){

totalCost+=175;

}

}else if(policy.equalsIgnoreCase("Auto")){

totalCost+=200;

}else{

int val = JOptionPane.showConfirmDialog(null,

"the program does not support that type of insurance policy at this time. Would you like to buy other policy?",

"Buy Confirmation!!!",

JOptionPane.YES_NO_OPTION);

if(val!=0){

System.exit(0);

}

if(val==0){

continue;

}

}

int val = JOptionPane.showConfirmDialog(null,

"Policy cost is : $"+totalCost*1.00+". Click yes to buy",

"Buy Confirmation!!!",

JOptionPane.YES_NO_OPTION);

if(val==0){

totalCost+=175;

break;

}

}else{

break;

}

}

}

}

output:


Related Solutions

In java Create a program to calculate interest rate and total balance - the program consists...
In java Create a program to calculate interest rate and total balance - the program consists of (a) A class that encapsulates the interest rate and total balance calculation Constructor should accept initial balance and interest rate Methods: Returns interest rate Returns total balance Set interest rate Set initial balance (b) A test program that uses class from step (A) to perform the following: Set interest rate to 5% and initial balance to 1000 Print interest amount and total balance...
Write a program to help a small company calculate the amount of money to pay its...
Write a program to help a small company calculate the amount of money to pay its employees. In this simplistic world, the company has exactly three employees. However, the number of hours per employee may vary. The company will apply the same tax rate to every employee The program must be written in Java. Prompt the user for the inputs and store the values in variables Must include all the inputs and outputs listed here and perform the calculations correctly...
Create a spreadsheet to calculate your projected total costs, total revenues, and total profits for giving...
Create a spreadsheet to calculate your projected total costs, total revenues, and total profits for giving a seminar on cost estimating. Make the following assumptions: You will charge $995 per person for a two-day class. You estimate that 30 people will attend the class, but you should keep an option to change this input. Your fixed costs include $500 total to rent a room for both days, setup fees of $500 for registration, and $300 for designing a postcard for...
Problem 1: In java Create a program to calculate interest rate and total balance - the...
Problem 1: In java Create a program to calculate interest rate and total balance - the program consists of (a) A class that encapsulates the interest rate and total balance calculation Constructor should accept initial balance and interest rate Methods: Returns interest rate Returns total balance Set interest rate Set initial balance (b) A test program that uses class from step (A) to perform the following: Set interest rate to 5% and initial balance to 1000 Print interest amount and...
Exercise 2: Create a spreadsheet to calculate your projected total costs, total revenues, and total profits...
Exercise 2: Create a spreadsheet to calculate your projected total costs, total revenues, and total profits for giving a seminar on cost estimating. Make the following assumptions: You will charge $600 per person for a two-day class. You estimate that 30 people will attend the class, but you want to change this input. Your fixed costs include $500 total to rent a room for both days, setup fees of $400 for registration, and $300 for designing a postcard for advertising....
EasyPoker Inc. needs to develop an estimate of its cost of capital. The firm’s marginal tax...
EasyPoker Inc. needs to develop an estimate of its cost of capital. The firm’s marginal tax rate is 30%. The current price of EasyPoker’s 12 percent coupon, semiannual payment bonds with 15 years remaining to maturity is $1,153.72. The current price of the firm’s 10%, $100 par value quarterly dividend perpetual preferred stock is $110.00. EasyPoker’s common stock is currently selling at $50 per share. Its last dividend was 4.19, and dividends are expected to grow at a constant rate...
Hashem Hats Inc. needs to develop an estimate of its cost of capital. Assume that you...
Hashem Hats Inc. needs to develop an estimate of its cost of capital. Assume that you are an assistant to the financial vice president. He has provided you with the following information: The firm’s marginal tax rate is 40%. The current price of the firm’s 12 percent coupon, semiannual payment bonds with 15 years remaining to maturity is $1,153.72. The current price of the firm’s 10% $100 par value quarterly dividend perpetual preferred stock is $110.00. TSI’s common stock is...
james inc. charges $2,800 for its hand-crafted guitars. The cost function that describes the total cost,...
james inc. charges $2,800 for its hand-crafted guitars. The cost function that describes the total cost, C, as a function of the guitars crafted and sold, x, is: C(x) = 2000x + 4x 2 + 30000 a) Formulate the profit function, P(x). b) How many game boards must be crafted and sold in order to maximize the total profit? c) What is the maximum profit? d) How many game boards must be crafted and sold in order to break even?
Brook’s Window Shields Inc. is trying to calculate its cost of capital for use in a...
Brook’s Window Shields Inc. is trying to calculate its cost of capital for use in a capital budgeting decision. Mr. Glass, the vice-president of finance, has given you the following information and has asked you to compute the weighted average cost of capital. The company currently has outstanding a bond with a 12.2 percent coupon rate and another bond with a 9.5 percent coupon rate. The firm has been informed by its investment banker that bonds of equal risk and...
Brook’s Window Shields Inc. is trying to calculate its cost of capital for use in a...
Brook’s Window Shields Inc. is trying to calculate its cost of capital for use in a capital budgeting decision. Mr. Glass, the vice-president of finance, has given you the following information and has asked you to compute the weighted average cost of capital. The company currently has outstanding a bond with a 9.2 percent coupon rate and another bond with a 6.2 percent coupon rate. The firm has been informed by its investment banker that bonds of equal risk and...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT