# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <iomanip>
using namespace std;


// This program uses a structure to hold data about a rectangle 
// PLACE YOUR NAME HERE

// FILL IN CODE TO define a structure named rectangle which has 
// members length, width, area, and perimeter all of which are floats

int main()
{
    // Fill IN CODE to declare a rectangle variable named box

    cout << "Enter the length of a rectangle: ";
	
	// FILL IN CODE to read in the length member of box

	cout << "Enter the width of a rectangle: ";
	
	// FILL IN CODE to read in the width member of box

	cout << endl << endl;

	// FILL IN CODE to compute the area member of box
	// FILL IN CODE to compute the perimeter member of box

	cout << fixed << showpoint << setprecision(2);
	

    // FILL IN CODE to output the area with an appropriate message
	// FILL IN CODE to output the perimeter with an appropriate message


	return 0;
}

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <string>
using namespace std;


// This program demonstrates partially initialized strucure variables

// PLACE YOUR NAME HERE

struct taxPayer
{
	string name;
	long int socialSecNum;
	float taxRate;
	float income;
	float taxes;
};

int main()
{
	// Fill in code to initialize a structure variable named citizen1 so that
	// the first three members are initilized.  Assume the name is Tim 
	// McGuiness,the social security number is 255871234, and the tax rate is .35

	// Fill in code to initialize a structure variable named citizen2 so that 
	// the first three members are initialized.  Assume the name is John Kane,
	// the social security number is 278990582, and the tax rate is .29
	
	cout << fixed << showpoint << setprecision(2);

	// calculate taxes due for citizen1

	// Fill in code to prompt the user to enter this year's income for the citizen1
	// Fill in code to read in this income to the appropriate structure member

	// Fill in code to determine this year's taxes for citizen1

	
	cout << "Name: " << citizen1.name << endl;
	cout << "Social Security Number: " << citizen1.socialSecNum << endl;
	
	cout << "Taxes due for this year: $" << citizen1.taxes << endl << endl;

	// calculate taxes due for citizen2

	// FILL IN CODE to prompt the user to enter this year's income for citizen2
	// FILL IN CODE to read in this income to the appropriate structure member

	// FILL IN CODE to determine this year's taxes for citizen2



	cout << "Name: " << citizen2.name << endl;
	cout << "Social Security Number: " << citizen2.socialSecNum << endl;

	cout << "Taxes due for this year: $" << citizen2.taxes << endl << endl;

	return 0;
}


# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <iomanip>

using namespace std;


// This program demonstrates how to use an array of structures
// PLACE YOUR NAME HERE

// Fill in code to define a structure called taxPayer that has three 
// members:  taxRate, income, and taxes -- each of type float


int main()
{
   // Fill in code to declare an array named citizen which holds
   // 5 taxPayers structures

	cout << fixed << showpoint << setprecision(2);

	cout << "Please enter the annual income and tax rate for 5 tax payers: ";
	cout << endl << endl << endl;

	for(int count = 0;count < 5;count++)
	{

		cout << "Enter this year's income for tax payer " << (count + 1);
		cout << ": ";
		
		// Fill in code to read in the income to the appropriate place

		cout << "Enter the tax rate for tax payer # " << (count + 1);
		cout << ": ";
		
		// Fill in code to read in the tax rate to the appropriate place

		// Fill in code to compute the taxes for the citizen and store it
		// in the appropriate place

	   
		cout << endl;
	}

	cout << "Taxes due for this year: " << endl << endl;

	// Fill in code for the first line of a loop that will output the 
	// tax information
	{
		cout << "Tax Payer # " << (index + 1) << ": " << "$ "
			 << citizen[index].taxes << endl;
	}

	return 0;
}

# data[].attributes.headline
Structure Lab - Codes - nestedRect_struct

# data[].attributes.subject
Structure Lab - Codes - nestedRect_struct

# data[].attributes.attachment_link.readable_text
#include <iostream>
#include <iomanip>

using namespace std;


// This program uses a structure to hold data about a rectangle 
// It calculates the area and perimeter of a box 

// PLACE YOUR NAME HERE

// Fill in code to define a structure named dimensions that
// contains 2 float members, length and width

// Fill in code to define a structure named rectangle that contains
// 3 members, area, perimeter, and sizes.  area and perimeter should be
// floats, whereas sizes should be a dimensions structure variable

int main()
{
   // Fill in code to declare a rectangle structure variable named box.
	
   cout << "Enter the length of a rectangle: ";
   
   // Fill in code to read in the length to the appropriate location

   cout << "Enter the width of a rectangle: ";

   // Fill in code to read in the width to the appropriate location 

   cout << endl << endl;

   // Fill in code to compute the area and store it in the appropriate
   // location
   // Fill in code to compute the perimeter and store it in the 
   // appropriate location

   cout << fixed << showpoint << setprecision(2);
   cout << "The area of the rectangle is " << box.attributes.area << endl; 
   cout << "The perimeter of the recangle is " <<  box.attributes.perimeter
        << endl;

   return 0;
}
