BYU Health Insurance

Problem Statement

• Write a program to determine a user’s monthly health insurance premium based on their marital status and the number of dependents.

Values taken from http://www.dmba.com/nsc/handbooks/student/hbbyuldsbc2014.pdf#page=15

Solution

/*
Test Case 1:
Input: single, 0 dependents
Output: 74
Actual: 74

Test Case 2:
Input: single, 2 dependents
Output: 273.50
Actual: 273.50

Test Case 3:
Input: married, 0 dependents
Output: 118.50
Actual: 118.50

Test Case 4:
Input: married, 2 dependents
Output: 413.50
Actual: 413.50
*/

#include <iostream>
#include <string>

using namespace std;

const string TRUE = "Y";

int main()
{
// INPUTS: whether single or married, dependents or no dependents

string is_single = "Y";
string has_dependents = "N";

// Prompt user
cout << "Are you single? (Y/N)";
cin >> is_single;

cout << "Do you have dependents? (Y/N)";
cin >> has_dependents;

// Decide which premium they should pay
if (is_single == TRUE)
{
if (has_dependents == TRUE)
{
}
else
{
}
}
else
{
if (has_dependents == TRUE)
{
}