.com.unity Forums
  The Official e-Store of Shrapnel Games

This Month's Specials

Raging Tiger- Save $9.00
winSPMBT: Main Battle Tank- Save $6.00

   







Go Back   .com.unity Forums > Shrapnel Community > Space Empires: IV & V

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old April 20th, 2005, 12:30 PM
geoschmo's Avatar

geoschmo geoschmo is offline
National Security Advisor
 
Join Date: Jan 2001
Location: Ohio
Posts: 8,450
Thanks: 0
Thanked 4 Times in 1 Post
geoschmo is on a distinguished road
Default OT: Look what I can do...

My first C++ program.

Yay me.

Code:
 //**************************************************  *******
//* *
//* CIS 233.01 Program Lab 1: Chapter 3, Ex 4 (Pg 143) *
//* Written by: George Perley *
//* Date: April 18, 2005 *
//* *
//************************************************** *******

#include <iostream> // Must include for cin and cout
#include <fstream> // Must include for file input and output functions
#include <iomanip> // Must include for setw , fixed and setprecision functions
using namespace std; // This is so the program knows how to use cin and cout

int main() // Start of main function
{

const double taxableAmountRate = .92; // Set constant for amount of assesed value that is taxable
const double taxRate = 1.05; // Set constant for tax per $100 of taxable value

double assesedValue; // declare variable for assesed value of property
double taxableAmount; // declare variable for caluclated taxable value of property
double propertyTax; // declare variable for calculated property tax amount

ofstream fout; // declare file output command

fout.open("Lab1OutputFile.txt"); // open text file

cout << "Please enter the assesed value of the property: "; // Prompt user for assesed value
cin >> assesedValue; // Get assesed value input from user
cout << endl; // carriage return before displaying results

taxableAmount = assesedValue * taxableAmountRate; // Calculate taxable portion of proprety value
propertyTax = (taxableAmount / 100) * taxRate; // Calculate property tax

cout << setfill(' '); // set fill to blank spaces for formatting of output to screen
cout << fixed << showpoint << setprecision(2); // desplay numbers on screen in two digit decimal notation.

cout << left << "Assessed Value: " << setw(25) << right << assesedValue << endl; // Screen output
cout << left << "Taxable Amount: " << setw(25) << right << taxableAmount << endl; // Screen output
cout << left << "Tax Rate for each $100.00: " << setw(14) << right << taxRate << endl; // Screen output
cout << left << "Property Tax: " << setw(27) << right << propertyTax << endl; // Screen output
cout << endl;

fout << setfill(' '); // set fill to blank spaces for formatting of output to file
fout << fixed << showpoint << setprecision(2); // display numbers in file in two digit decimal notation.

fout << left << "Assessed Value: " << setw(25) << right << assesedValue << endl; // Write to file
fout << left << "Taxable Amount: " << setw(25) << right << taxableAmount << endl; // Write to file
fout << left << "Tax Rate for each $100.00: " << setw(14) << right << taxRate << endl; // Write to file
fout << left << "Property Tax: " << setw(27) << right << propertyTax << endl; // Write to file

fout.close(); // close file




} // This is the end of the main function, and my program

__________________
I used to be somebody but now I am somebody else
Who I'll be tomorrow is anybody's guess
Reply With Quote
 

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 07:39 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©1999 - 2024, Shrapnel Games, Inc. - All Rights Reserved.