Prob-8 In shopping for a new house, you must consider several factors. In this p
ID: 3639117 • Letter: P
Question
Prob-8 In shopping for a new house, you must consider several factors. In this
problem the initial cost of the house, estimated annual fuel costs, and
annual tax rate are available. Write a program that will determine the
total cost after a five-year period for each set of house data below. You
should be able to inspect your program output to determine the "best
buy."
Initial House Cost Annual Fuel Cost Tax Rate
$175,000 $2500 0.025
$200,000 $2800 0.025
$210,000 $2050 0.020
To calculate the house cost, add the fuel cost for five years to the initial
cost, then add the taxes for five years. Taxes for one year are computed
by multiplying the tax rate by the initial cost. Write and call a function
that displays instructions to the program user and another function that
computes and returns the house cost given the initial cost, the annual
fuel cost, and the tax rate.
Explanation / Answer
while(){ @a = split(/"/); shift(@a); while($#a != -1){ print "$a[0] "; shift(@a) ; shift(@a); } } I ran the code on the following input file ljslASJ "one" ASDASD SJD "two" ASD "same line" "three"sdfsd"four""five" hehe "END" ;k;k and got the following output: one two same line three four five END Your file path contains the escape sequence . Instead use (preferred): char *fname = "c:\temp\tmp.txt"; or (this also works) char *fname = "c:/temp/tmp.txt"; If you are wondering what an escape sequence is: Escape Sequences Escape Sequence Represents Bell (alert) Backspace Formfeed New line Carriage return Horizontal tab Vertical tab ' Single quotation mark " Double quotation mark \ Backslash ? Literal question mark ooo ASCII character in octal notation xhhh ASCII character in hexadecimal notationRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.