writing a homework assignment for some car dealership thing and when i run the program the dos window comes up blank. i dont understand why!
PHP Code:<?php
$disco = array();
$sticker = 0;
$year = 0;
$code = 0;
$row = 0;
$col = 0;
$percent = 0.0;
$fb = fopen("discount.txt", 'r') or die("\n Can not find file discount.txt\n");
$r = 0;
while( $r <6)
{
fscanf($fb,"%f%f%f%f%f", $disco[$r][0],$disco[$r][1],$disco[$r][2],$disco[$r][3],$disco[$r][4]);
$r = $r + 1;
}
fscanf(STDIN, "%d", $sticker);
fscanf(STDIN, "%d", $year);
fscanf(STDIN, "%d", $code);
$row = 2006 - $year;
$col = $code - 1;
$discoPercent = $disco[$row][$col];
$percent = $col * 100;
$discountAmount = $col * $sticker;
$salePrice = $sticker - $discountAmount;
print("\nSticker price: $sticker");
print("\nDiscount: $percent %");
print("\nDiscount amount: %discountAmount");
print("\nSales prices: $salePrice");
fclose($fb);
?>
my data file:
0.050 0.055 0.060 0.065 0.070
0.040 0.045 0.050 0.055 0.060
0.030 0.035 0.040 0.045 0.050
0.020 0.025 0.030 0.035 0.040
0.010 0.015 0.020 0.025 0.030
0.005 0.010 0.015 0.020 0.025



Reply With Quote

Bookmarks